From ad51ea16106c96f1a6e87f4df1d50ade3b504a9d Mon Sep 17 00:00:00 2001 From: Stefan Widgren Date: Sat, 13 Jan 2018 11:56:29 +0100 Subject: [PATCH] Change 'allocVector' to 'Rf_allocVector' Signed-off-by: Stefan Widgren --- src/git2r_blame.c | 2 +- src/git2r_blob.c | 8 ++++---- src/git2r_branch.c | 16 ++++++++-------- src/git2r_commit.c | 2 +- src/git2r_config.c | 12 ++++++------ src/git2r_diff.c | 10 +++++----- src/git2r_graph.c | 2 +- src/git2r_libgit2.c | 8 ++++---- src/git2r_note.c | 6 +++--- src/git2r_odb.c | 32 ++++++++++++++++---------------- src/git2r_reference.c | 6 +++--- src/git2r_reflog.c | 4 ++-- src/git2r_remote.c | 8 ++++---- src/git2r_repository.c | 16 ++++++++-------- src/git2r_revwalk.c | 14 +++++++------- src/git2r_stash.c | 2 +- src/git2r_status.c | 28 ++++++++++++++-------------- src/git2r_tag.c | 8 ++++---- src/git2r_tree.c | 24 ++++++++++++------------ 19 files changed, 104 insertions(+), 104 deletions(-) diff --git a/src/git2r_blame.c b/src/git2r_blame.c index e5f4d9c71..d591ebe04 100644 --- a/src/git2r_blame.c +++ b/src/git2r_blame.c @@ -53,7 +53,7 @@ void git2r_blame_init(git_blame *source, SEXP repo, SEXP path, SEXP dest) SEXP s_path = Rf_install("path"); n = git_blame_get_hunk_count(source); - PROTECT(hunks = allocVector(VECSXP, n)); + PROTECT(hunks = Rf_allocVector(VECSXP, n)); SET_SLOT(dest, s_hunks, hunks); for (i = 0; i < n; i++) { const git_blame_hunk *hunk; diff --git a/src/git2r_blob.c b/src/git2r_blob.c index 078eba678..443b30704 100644 --- a/src/git2r_blob.c +++ b/src/git2r_blob.c @@ -52,7 +52,7 @@ SEXP git2r_blob_content(SEXP blob) if (err) goto cleanup; - PROTECT(result = allocVector(STRSXP, 1)); + PROTECT(result = Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(result, 0, mkChar(git_blob_rawcontent(blob_obj))); cleanup: @@ -94,7 +94,7 @@ SEXP git2r_blob_create_fromdisk(SEXP repo, SEXP path) git2r_error(__func__, NULL, git2r_err_invalid_repository, NULL); len = length(path); - PROTECT(result = allocVector(VECSXP, len)); + PROTECT(result = Rf_allocVector(VECSXP, len)); nprotect++; for (i = 0; i < len; i++) { if (NA_STRING != STRING_ELT(path, i)) { @@ -159,7 +159,7 @@ SEXP git2r_blob_create_fromworkdir(SEXP repo, SEXP relative_path) git2r_error(__func__, NULL, git2r_err_invalid_repository, NULL); len = length(relative_path); - PROTECT(result = allocVector(VECSXP, len)); + PROTECT(result = Rf_allocVector(VECSXP, len)); nprotect++; for (i = 0; i < len; i++) { if (NA_STRING != STRING_ELT(relative_path, i)) { @@ -247,7 +247,7 @@ SEXP git2r_blob_is_binary(SEXP blob) if (err) goto cleanup; - PROTECT(result = allocVector(LGLSXP, 1)); + PROTECT(result = Rf_allocVector(LGLSXP, 1)); if (git_blob_is_binary(blob_obj)) LOGICAL(result)[0] = 1; else diff --git a/src/git2r_branch.c b/src/git2r_branch.c index 16ff6fcd4..4a386814a 100644 --- a/src/git2r_branch.c +++ b/src/git2r_branch.c @@ -243,7 +243,7 @@ SEXP git2r_branch_is_head(SEXP branch) err = git_branch_is_head(reference); if (0 == err || 1 == err) { - PROTECT(result = allocVector(LGLSXP, 1)); + PROTECT(result = Rf_allocVector(LGLSXP, 1)); LOGICAL(result)[0] = err; err = GIT_OK; } @@ -294,8 +294,8 @@ SEXP git2r_branch_list(SEXP repo, SEXP flags) err = git2r_branch_count(repository, INTEGER(flags)[0], &n); if (err) goto cleanup; - PROTECT(result = allocVector(VECSXP, n)); - setAttrib(result, R_NamesSymbol, names = allocVector(STRSXP, n)); + PROTECT(result = Rf_allocVector(VECSXP, n)); + setAttrib(result, R_NamesSymbol, names = Rf_allocVector(STRSXP, n)); err = git_branch_iterator_new(&iter, repository, INTEGER(flags)[0]); if (err) @@ -371,7 +371,7 @@ SEXP git2r_branch_canonical_name(SEXP branch) if (err) goto cleanup; - PROTECT(result = allocVector(STRSXP, 1)); + PROTECT(result = Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(result, 0, mkChar(git_reference_name(reference))); cleanup: @@ -437,7 +437,7 @@ SEXP git2r_branch_upstream_canonical_name(SEXP branch) if (err) goto cleanup; - PROTECT(result = allocVector(STRSXP, 1)); + PROTECT(result = Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(result, 0, mkChar(name)); cleanup: @@ -497,7 +497,7 @@ SEXP git2r_branch_remote_name(SEXP branch) if (err) goto cleanup; - PROTECT(result = allocVector(STRSXP, 1)); + PROTECT(result = Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(result, 0, mkChar(buf.ptr)); git_buf_free(&buf); @@ -567,7 +567,7 @@ SEXP git2r_branch_remote_url(SEXP branch) } git_buf_free(&buf); - PROTECT(result = allocVector(STRSXP, 1)); + PROTECT(result = Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(result, 0, mkChar(git_remote_url(remote))); cleanup: @@ -692,7 +692,7 @@ SEXP git2r_branch_target(SEXP branch) if (err) goto cleanup; - PROTECT(result = allocVector(STRSXP, 1)); + PROTECT(result = Rf_allocVector(STRSXP, 1)); if (GIT_REF_OID == git_reference_type(reference)) { git_oid_fmt(sha, git_reference_target(reference)); sha[GIT_OID_HEXSZ] = '\0'; diff --git a/src/git2r_commit.c b/src/git2r_commit.c index 4cff27c38..bed03ec43 100644 --- a/src/git2r_commit.c +++ b/src/git2r_commit.c @@ -509,7 +509,7 @@ SEXP git2r_commit_parent_list(SEXP commit) goto cleanup; n = git_commit_parentcount(commit_obj); - PROTECT(list = allocVector(VECSXP, n)); + PROTECT(list = Rf_allocVector(VECSXP, n)); for (i = 0; i < n; i++) { git_commit *parent = NULL; diff --git a/src/git2r_config.c b/src/git2r_config.c index 81b1edd82..4e3afdcd0 100644 --- a/src/git2r_config.c +++ b/src/git2r_config.c @@ -114,8 +114,8 @@ static size_t git2r_config_list_init( SET_VECTOR_ELT( list, i_list[level], - item = allocVector(VECSXP, n_level[level])); - setAttrib(item, R_NamesSymbol, allocVector(STRSXP, n_level[level])); + item = Rf_allocVector(VECSXP, n_level[level])); + setAttrib(item, R_NamesSymbol, Rf_allocVector(STRSXP, n_level[level])); names = getAttrib(list, R_NamesSymbol); SET_STRING_ELT(names, i_list[level] , mkChar(name)); } @@ -304,8 +304,8 @@ SEXP git2r_config_get(SEXP repo) n++; } - PROTECT(result = allocVector(VECSXP, n)); - setAttrib(result, R_NamesSymbol, allocVector(STRSXP, n)); + PROTECT(result = Rf_allocVector(VECSXP, n)); + setAttrib(result, R_NamesSymbol, Rf_allocVector(STRSXP, n)); if (git2r_config_list_variables(cfg, result, n_level)) goto cleanup; @@ -414,7 +414,7 @@ SEXP git2r_config_get_string(SEXP repo, SEXP name) goto cleanup; } - PROTECT(result = allocVector(STRSXP, 1)); + PROTECT(result = Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(result, 0, mkChar(value)); cleanup: @@ -459,7 +459,7 @@ SEXP git2r_config_get_logical(SEXP repo, SEXP name) goto cleanup; } - PROTECT(result = allocVector(LGLSXP, 1)); + PROTECT(result = Rf_allocVector(LGLSXP, 1)); if (value) LOGICAL(result)[0] = 1; else diff --git a/src/git2r_diff.c b/src/git2r_diff.c index 46faae283..7b0d8863e 100644 --- a/src/git2r_diff.c +++ b/src/git2r_diff.c @@ -801,7 +801,7 @@ int git2r_diff_get_file_cb(const git_diff_delta *delta, SET_SLOT( VECTOR_ELT(p->result, p->file_ptr-1), s_hunks, - hunks = allocVector(VECSXP, p->hunk_ptr)); + hunks = Rf_allocVector(VECSXP, p->hunk_ptr)); for (i = 0; i < len ; i++) SET_VECTOR_ELT(hunks, i, VECTOR_ELT(p->hunk_tmp, i)); } @@ -852,7 +852,7 @@ int git2r_diff_get_hunk_cb(const git_diff_delta *delta, size_t len=p->line_ptr, i; SEXP s_lines = Rf_install("lines"); - PROTECT(lines = allocVector(VECSXP, p->line_ptr)); + PROTECT(lines = Rf_allocVector(VECSXP, p->line_ptr)); SET_SLOT(VECTOR_ELT(p->hunk_tmp, p->hunk_ptr-1), s_lines, lines); for (i = 0; i < len; i++) SET_VECTOR_ELT(lines, i, VECTOR_ELT(p->line_tmp, i)); @@ -973,10 +973,10 @@ int git2r_diff_format_to_r(git_diff *diff, SEXP dest) if (err) return err; - PROTECT(payload.result = allocVector(VECSXP, num_files)); + PROTECT(payload.result = Rf_allocVector(VECSXP, num_files)); SET_SLOT(dest, Rf_install("files"), payload.result); - PROTECT(payload.hunk_tmp = allocVector(VECSXP, max_hunks)); - PROTECT(payload.line_tmp = allocVector(VECSXP, max_lines)); + PROTECT(payload.hunk_tmp = Rf_allocVector(VECSXP, max_hunks)); + PROTECT(payload.line_tmp = Rf_allocVector(VECSXP, max_lines)); err = git_diff_foreach( diff, diff --git a/src/git2r_graph.c b/src/git2r_graph.c index 1a475d2bb..905205312 100644 --- a/src/git2r_graph.c +++ b/src/git2r_graph.c @@ -67,7 +67,7 @@ SEXP git2r_graph_ahead_behind(SEXP local, SEXP upstream) if (err) goto cleanup; - PROTECT(result = allocVector(INTSXP, 2)); + PROTECT(result = Rf_allocVector(INTSXP, 2)); nprotect++; INTEGER(result)[0] = ahead; INTEGER(result)[1] = behind; diff --git a/src/git2r_libgit2.c b/src/git2r_libgit2.c index 40cbd86bb..5c9a7fcf5 100644 --- a/src/git2r_libgit2.c +++ b/src/git2r_libgit2.c @@ -32,8 +32,8 @@ SEXP git2r_libgit2_features(void) int value; value = git_libgit2_features(); - PROTECT(features = allocVector(VECSXP, 3)); - setAttrib(features, R_NamesSymbol, names = allocVector(STRSXP, 3)); + PROTECT(features = Rf_allocVector(VECSXP, 3)); + setAttrib(features, R_NamesSymbol, names = Rf_allocVector(STRSXP, 3)); SET_STRING_ELT(names, 0, mkChar("threads")); if (value & GIT_FEATURE_THREADS) @@ -69,8 +69,8 @@ SEXP git2r_libgit2_version(void) int major, minor, rev; git_libgit2_version(&major, &minor, &rev); - PROTECT(version = allocVector(VECSXP, 3)); - setAttrib(version, R_NamesSymbol, names = allocVector(STRSXP, 3)); + PROTECT(version = Rf_allocVector(VECSXP, 3)); + setAttrib(version, R_NamesSymbol, names = Rf_allocVector(STRSXP, 3)); SET_VECTOR_ELT(version, 0, ScalarInteger(major)); SET_VECTOR_ELT(version, 1, ScalarInteger(minor)); SET_VECTOR_ELT(version, 2, ScalarInteger(rev)); diff --git a/src/git2r_note.c b/src/git2r_note.c index 3469cec3d..cdfe34eba 100644 --- a/src/git2r_note.c +++ b/src/git2r_note.c @@ -210,7 +210,7 @@ SEXP git2r_note_default_ref(SEXP repo) if (err) goto cleanup; - PROTECT(result = allocVector(STRSXP, 1)); + PROTECT(result = Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(result, 0, mkChar(buf.ptr)); cleanup: @@ -310,13 +310,13 @@ SEXP git2r_notes(SEXP repo, SEXP ref) if (err) { if (GIT_ENOTFOUND == err) { err = GIT_OK; - PROTECT(result = allocVector(VECSXP, 0)); + PROTECT(result = Rf_allocVector(VECSXP, 0)); } goto cleanup; } - PROTECT(result = allocVector(VECSXP, cb_data.n)); + PROTECT(result = Rf_allocVector(VECSXP, cb_data.n)); cb_data.n = 0; cb_data.list = result; cb_data.repo = repo; diff --git a/src/git2r_odb.c b/src/git2r_odb.c index 6a7ea2660..83d89f9c6 100644 --- a/src/git2r_odb.c +++ b/src/git2r_odb.c @@ -44,7 +44,7 @@ SEXP git2r_odb_hash(SEXP data) git2r_error(__func__, NULL, "'data'", git2r_err_string_vec_arg); len = length(data); - PROTECT(result = allocVector(STRSXP, len)); + PROTECT(result = Rf_allocVector(STRSXP, len)); for (i = 0; i < len; i++) { if (NA_STRING == STRING_ELT(data, i)) { SET_STRING_ELT(result, i, NA_STRING); @@ -89,7 +89,7 @@ SEXP git2r_odb_hashfile(SEXP path) git2r_error(__func__, NULL, "'path'", git2r_err_string_vec_arg); len = length(path); - PROTECT(result = allocVector(STRSXP, len)); + PROTECT(result = Rf_allocVector(STRSXP, len)); for (i = 0; i < len; i++) { if (NA_STRING == STRING_ELT(path, i)) { SET_STRING_ELT(result, i, NA_STRING); @@ -229,15 +229,15 @@ SEXP git2r_odb_objects(SEXP repo) if (err) goto cleanup; - PROTECT(result = allocVector(VECSXP, 3)); - setAttrib(result, R_NamesSymbol, names = allocVector(STRSXP, 3)); + PROTECT(result = Rf_allocVector(VECSXP, 3)); + setAttrib(result, R_NamesSymbol, names = Rf_allocVector(STRSXP, 3)); i = 0; - SET_VECTOR_ELT(result, i, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, i, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, i++, mkChar("sha")); - SET_VECTOR_ELT(result, i, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, i, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, i++, mkChar("type")); - SET_VECTOR_ELT(result, i, allocVector(INTSXP, cb_data.n)); + SET_VECTOR_ELT(result, i, Rf_allocVector(INTSXP, cb_data.n)); SET_STRING_ELT(names, i++, mkChar("len")); cb_data.list = result; @@ -504,23 +504,23 @@ SEXP git2r_odb_blobs(SEXP repo) if (err) goto cleanup; - PROTECT(result = allocVector(VECSXP, 7)); - setAttrib(result, R_NamesSymbol, names = allocVector(STRSXP, 7)); + PROTECT(result = Rf_allocVector(VECSXP, 7)); + setAttrib(result, R_NamesSymbol, names = Rf_allocVector(STRSXP, 7)); i = 0; - SET_VECTOR_ELT(result, i, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, i, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, i++, mkChar("sha")); - SET_VECTOR_ELT(result, i, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, i, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, i++, mkChar("path")); - SET_VECTOR_ELT(result, i, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, i, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, i++, mkChar("name")); - SET_VECTOR_ELT(result, i, allocVector(INTSXP, cb_data.n)); + SET_VECTOR_ELT(result, i, Rf_allocVector(INTSXP, cb_data.n)); SET_STRING_ELT(names, i++, mkChar("len")); - SET_VECTOR_ELT(result, i, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, i, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, i++, mkChar("commit")); - SET_VECTOR_ELT(result, i, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, i, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, i++, mkChar("author")); - SET_VECTOR_ELT(result, i, allocVector(REALSXP, cb_data.n)); + SET_VECTOR_ELT(result, i, Rf_allocVector(REALSXP, cb_data.n)); SET_STRING_ELT(names, i++, mkChar("when")); cb_data.list = result; diff --git a/src/git2r_reference.c b/src/git2r_reference.c index 8fcfa6d68..6efcf0268 100644 --- a/src/git2r_reference.c +++ b/src/git2r_reference.c @@ -53,7 +53,7 @@ SEXP git2r_reference_dwim(SEXP repo, SEXP shorthand) if (err) goto cleanup; - PROTECT(result = allocVector(STRSXP, 1)); + PROTECT(result = Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(result, 0, mkChar(git_reference_name(reference))); cleanup: @@ -130,11 +130,11 @@ SEXP git2r_reference_list(SEXP repo) if (err) goto cleanup; - PROTECT(result = allocVector(VECSXP, ref_list.count)); + PROTECT(result = Rf_allocVector(VECSXP, ref_list.count)); setAttrib( result, R_NamesSymbol, - names = allocVector(STRSXP, ref_list.count)); + names = Rf_allocVector(STRSXP, ref_list.count)); for (i = 0; i < ref_list.count; i++) { SEXP reference; diff --git a/src/git2r_reflog.c b/src/git2r_reflog.c index 5de8c6f73..42efed959 100644 --- a/src/git2r_reflog.c +++ b/src/git2r_reflog.c @@ -57,7 +57,7 @@ void git2r_reflog_entry_init( sha[GIT_OID_HEXSZ] = '\0'; SET_SLOT(dest, s_sha, mkString(sha)); - SET_SLOT(dest, s_index, i = allocVector(INTSXP, 1)); + SET_SLOT(dest, s_index, i = Rf_allocVector(INTSXP, 1)); INTEGER(i)[0] = index; committer = git_reflog_entry_committer(source); @@ -101,7 +101,7 @@ SEXP git2r_reflog_list(SEXP repo, SEXP ref) goto cleanup; n = git_reflog_entrycount(reflog); - PROTECT(result = allocVector(VECSXP, n)); + PROTECT(result = Rf_allocVector(VECSXP, n)); for (i = 0; i < n; i++) { const git_reflog_entry *entry = git_reflog_entry_byindex(reflog, i); diff --git a/src/git2r_remote.c b/src/git2r_remote.c index 8d799b14c..bfb0ea5b0 100644 --- a/src/git2r_remote.c +++ b/src/git2r_remote.c @@ -246,7 +246,7 @@ SEXP git2r_remote_list(SEXP repo) if (err) goto cleanup; - PROTECT(list = allocVector(STRSXP, rem_list.count)); + PROTECT(list = Rf_allocVector(STRSXP, rem_list.count)); for (i = 0; i < rem_list.count; i++) SET_STRING_ELT(list, i, mkChar(rem_list.strings[i])); @@ -404,7 +404,7 @@ SEXP git2r_remote_url(SEXP repo, SEXP remote) git2r_error(__func__, NULL, git2r_err_invalid_repository, NULL); len = LENGTH(remote); - PROTECT(url = allocVector(STRSXP, len)); + PROTECT(url = Rf_allocVector(STRSXP, len)); for (; i < len; i++) { if (NA_STRING == STRING_ELT(remote, i)) { @@ -488,8 +488,8 @@ SEXP git2r_remote_ls(SEXP name, SEXP repo, SEXP credentials) if (err) goto cleanup; - PROTECT(result = allocVector(STRSXP, refs_len)); - setAttrib(result, R_NamesSymbol, names = allocVector(STRSXP, refs_len)); + PROTECT(result = Rf_allocVector(STRSXP, refs_len)); + setAttrib(result, R_NamesSymbol, names = Rf_allocVector(STRSXP, refs_len)); for (i = 0; i < refs_len; i++) { char oid[GIT_OID_HEXSZ + 1] = {0}; diff --git a/src/git2r_repository.c b/src/git2r_repository.c index 05a7cca58..8335aa770 100644 --- a/src/git2r_repository.c +++ b/src/git2r_repository.c @@ -138,7 +138,7 @@ SEXP git2r_repository_fetch_heads(SEXP repo) goto cleanup; } - PROTECT(result = allocVector(VECSXP, cb_data.n)); + PROTECT(result = Rf_allocVector(VECSXP, cb_data.n)); cb_data.n = 0; cb_data.list = result; cb_data.repo = repo; @@ -274,7 +274,7 @@ SEXP git2r_repository_is_bare(SEXP repo) is_bare = git_repository_is_bare(repository); git_repository_free(repository); - PROTECT(result = allocVector(LGLSXP, 1)); + PROTECT(result = Rf_allocVector(LGLSXP, 1)); if (1 == is_bare) LOGICAL(result)[0] = 1; else @@ -305,7 +305,7 @@ SEXP git2r_repository_is_shallow(SEXP repo) if (is_shallow < 0) git2r_error(__func__, giterr_last(), NULL, NULL); - PROTECT(result = allocVector(LGLSXP, 1)); + PROTECT(result = Rf_allocVector(LGLSXP, 1)); if (1 == is_shallow) LOGICAL(result)[0] = 1; else @@ -336,7 +336,7 @@ SEXP git2r_repository_head_detached(SEXP repo) if (head_detached < 0) git2r_error(__func__, giterr_last(), NULL, NULL); - PROTECT(result = allocVector(LGLSXP, 1)); + PROTECT(result = Rf_allocVector(LGLSXP, 1)); if (1 == head_detached) LOGICAL(result)[0] = 1; else @@ -367,7 +367,7 @@ SEXP git2r_repository_is_empty(SEXP repo) if (is_empty < 0) git2r_error(__func__, giterr_last(), NULL, NULL); - PROTECT(result = allocVector(LGLSXP, 1)); + PROTECT(result = Rf_allocVector(LGLSXP, 1)); if (1 == is_empty) LOGICAL(result)[0] = 1; else @@ -396,7 +396,7 @@ SEXP git2r_repository_can_open(SEXP path) if (repository) git_repository_free(repository); - PROTECT(result = allocVector(LGLSXP, 1)); + PROTECT(result = Rf_allocVector(LGLSXP, 1)); if (0 != can_open) LOGICAL(result)[0] = 0; else @@ -504,7 +504,7 @@ SEXP git2r_repository_workdir(SEXP repo) if (!git_repository_is_bare(repository)) { const char *wd = git_repository_workdir(repository); - PROTECT(result = allocVector(STRSXP, 1)); + PROTECT(result = Rf_allocVector(STRSXP, 1)); nprotect++; SET_STRING_ELT(result, 0, mkChar(wd)); } @@ -556,7 +556,7 @@ SEXP git2r_repository_discover(SEXP path, SEXP ceiling) goto cleanup; } - PROTECT(result = allocVector(STRSXP, 1)); + PROTECT(result = Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(result, 0, mkChar(buf.ptr)); cleanup: diff --git a/src/git2r_revwalk.c b/src/git2r_revwalk.c index 568daf2bf..953f4f331 100644 --- a/src/git2r_revwalk.c +++ b/src/git2r_revwalk.c @@ -89,7 +89,7 @@ SEXP git2r_revwalk_list( if (git_repository_is_empty(repository)) { /* No commits, create empty list */ - PROTECT(result = allocVector(VECSXP, 0)); + PROTECT(result = Rf_allocVector(VECSXP, 0)); goto cleanup; } @@ -113,7 +113,7 @@ SEXP git2r_revwalk_list( n = git2r_revwalk_count(walker, INTEGER(max_n)[0]); /* Create list to store result */ - PROTECT(result = allocVector(VECSXP, n)); + PROTECT(result = Rf_allocVector(VECSXP, n)); git_revwalk_reset(walker); err = git_revwalk_push_head(walker); @@ -220,13 +220,13 @@ SEXP git2r_revwalk_contributions( n = git2r_revwalk_count(walker, -1); /* Create vectors to store result */ - PROTECT(result = allocVector(VECSXP, 3)); - setAttrib(result, R_NamesSymbol, names = allocVector(STRSXP, 3)); - SET_VECTOR_ELT(result, 0, when = allocVector(REALSXP, n)); + PROTECT(result = Rf_allocVector(VECSXP, 3)); + setAttrib(result, R_NamesSymbol, names = Rf_allocVector(STRSXP, 3)); + SET_VECTOR_ELT(result, 0, when = Rf_allocVector(REALSXP, n)); SET_STRING_ELT(names, 0, mkChar("when")); - SET_VECTOR_ELT(result, 1, author = allocVector(STRSXP, n)); + SET_VECTOR_ELT(result, 1, author = Rf_allocVector(STRSXP, n)); SET_STRING_ELT(names, 1, mkChar("author")); - SET_VECTOR_ELT(result, 2, email = allocVector(STRSXP, n)); + SET_VECTOR_ELT(result, 2, email = Rf_allocVector(STRSXP, n)); SET_STRING_ELT(names, 2, mkChar("email")); git_revwalk_reset(walker); diff --git a/src/git2r_stash.c b/src/git2r_stash.c index 47d32274b..85aa84464 100644 --- a/src/git2r_stash.c +++ b/src/git2r_stash.c @@ -158,7 +158,7 @@ SEXP git2r_stash_list(SEXP repo) if (err) goto cleanup; - PROTECT(list = allocVector(VECSXP, cb_data.n)); + PROTECT(list = Rf_allocVector(VECSXP, cb_data.n)); cb_data.n = 0; cb_data.list = list; cb_data.repo = repo; diff --git a/src/git2r_status.c b/src/git2r_status.c index f2558ca73..12ca0c991 100644 --- a/src/git2r_status.c +++ b/src/git2r_status.c @@ -152,8 +152,8 @@ static void git2r_status_list_ignored( /* Create list with the correct number of entries */ count = git2r_status_count_ignored(status_list); - SET_VECTOR_ELT(list, list_index, item = allocVector(VECSXP, count)); - setAttrib(item, R_NamesSymbol, names = allocVector(STRSXP, count)); + SET_VECTOR_ELT(list, list_index, item = Rf_allocVector(VECSXP, count)); + setAttrib(item, R_NamesSymbol, names = Rf_allocVector(STRSXP, count)); /* i index the entrycount. j index the added change in list */ count = git_status_list_entrycount(status_list); @@ -187,8 +187,8 @@ static void git2r_status_list_staged( /* Create list with the correct number of entries */ n = git2r_status_count_staged(status_list); - SET_VECTOR_ELT(list, list_index, sub_list = allocVector(VECSXP, n)); - setAttrib(sub_list, R_NamesSymbol, sub_list_names = allocVector(STRSXP, n)); + SET_VECTOR_ELT(list, list_index, sub_list = Rf_allocVector(VECSXP, n)); + setAttrib(sub_list, R_NamesSymbol, sub_list_names = Rf_allocVector(STRSXP, n)); /* i index the entrycount. j index the added change in list */ n = git_status_list_entrycount(status_list); @@ -220,12 +220,12 @@ static void git2r_status_list_staged( if (old_path && new_path && strcmp(old_path, new_path)) { SEXP item; - SET_VECTOR_ELT(sub_list, j, item = allocVector(STRSXP, 2)); + SET_VECTOR_ELT(sub_list, j, item = Rf_allocVector(STRSXP, 2)); SET_STRING_ELT(item, 0, mkChar(old_path)); SET_STRING_ELT(item, 1, mkChar(new_path)); } else { SEXP item; - SET_VECTOR_ELT(sub_list, j, item = allocVector(STRSXP, 1)); + SET_VECTOR_ELT(sub_list, j, item = Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(item, 0, mkChar(old_path ? old_path : new_path)); } @@ -252,8 +252,8 @@ static void git2r_status_list_unstaged( /* Create list with the correct number of entries */ n = git2r_status_count_unstaged(status_list); - SET_VECTOR_ELT(list, list_index, sub_list = allocVector(VECSXP, n)); - setAttrib(sub_list, R_NamesSymbol, sub_list_names = allocVector(STRSXP, n)); + SET_VECTOR_ELT(list, list_index, sub_list = Rf_allocVector(VECSXP, n)); + setAttrib(sub_list, R_NamesSymbol, sub_list_names = Rf_allocVector(STRSXP, n)); /* i index the entrycount. j index the added change in list */ n = git_status_list_entrycount(status_list); @@ -287,12 +287,12 @@ static void git2r_status_list_unstaged( if (old_path && new_path && strcmp(old_path, new_path)) { SEXP item; - SET_VECTOR_ELT(sub_list, j, item = allocVector(STRSXP, 2)); + SET_VECTOR_ELT(sub_list, j, item = Rf_allocVector(STRSXP, 2)); SET_STRING_ELT(item, 0, mkChar(old_path)); SET_STRING_ELT(item, 1, mkChar(new_path)); } else { SEXP item; - SET_VECTOR_ELT(sub_list, j, item = allocVector(STRSXP, 1)); + SET_VECTOR_ELT(sub_list, j, item = Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(item, 0, mkChar(old_path ? old_path : new_path)); } @@ -319,8 +319,8 @@ static void git2r_status_list_untracked( /* Create list with the correct number of entries */ n = git2r_status_count_untracked(status_list); - SET_VECTOR_ELT(list, list_index, sub_list = allocVector(VECSXP, n)); - setAttrib(sub_list, R_NamesSymbol, sub_list_names = allocVector(STRSXP, n)); + SET_VECTOR_ELT(list, list_index, sub_list = Rf_allocVector(VECSXP, n)); + setAttrib(sub_list, R_NamesSymbol, sub_list_names = Rf_allocVector(STRSXP, n)); /* i index the entrycount. j index the added change in list */ n = git_status_list_entrycount(status_list); @@ -401,8 +401,8 @@ SEXP git2r_status_list( LOGICAL(untracked)[0] + LOGICAL(ignored)[0]; - PROTECT(list = allocVector(VECSXP, count)); - setAttrib(list, R_NamesSymbol, list_names = allocVector(STRSXP, count)); + PROTECT(list = Rf_allocVector(VECSXP, count)); + setAttrib(list, R_NamesSymbol, list_names = Rf_allocVector(STRSXP, count)); if (LOGICAL(staged)[0]) { SET_STRING_ELT(list_names, i, mkChar("staged")); diff --git a/src/git2r_tag.c b/src/git2r_tag.c index 574b36807..5568431de 100644 --- a/src/git2r_tag.c +++ b/src/git2r_tag.c @@ -287,15 +287,15 @@ SEXP git2r_tag_list(SEXP repo) if (err) { if (GIT_ENOTFOUND == err) { err = 0; - PROTECT(result = allocVector(VECSXP, 0)); - setAttrib(result, R_NamesSymbol, allocVector(STRSXP, 0)); + PROTECT(result = Rf_allocVector(VECSXP, 0)); + setAttrib(result, R_NamesSymbol, Rf_allocVector(STRSXP, 0)); } goto cleanup; } - PROTECT(result = allocVector(VECSXP, cb_data.n)); - setAttrib(result, R_NamesSymbol, allocVector(STRSXP, cb_data.n)); + PROTECT(result = Rf_allocVector(VECSXP, cb_data.n)); + setAttrib(result, R_NamesSymbol, Rf_allocVector(STRSXP, cb_data.n)); cb_data.n = 0; cb_data.tags = result; diff --git a/src/git2r_tree.c b/src/git2r_tree.c index ff1ef35ba..c36f22131 100644 --- a/src/git2r_tree.c +++ b/src/git2r_tree.c @@ -52,13 +52,13 @@ void git2r_tree_init(const git_tree *source, SEXP repo, SEXP dest) SET_SLOT(dest, s_sha, mkString(sha)); n = git_tree_entrycount(source); - PROTECT(filemode = allocVector(INTSXP, n)); + PROTECT(filemode = Rf_allocVector(INTSXP, n)); SET_SLOT(dest, s_filemode, filemode); - PROTECT(id = allocVector(STRSXP, n)); + PROTECT(id = Rf_allocVector(STRSXP, n)); SET_SLOT(dest, s_id, id); - PROTECT(type = allocVector(STRSXP, n)); + PROTECT(type = Rf_allocVector(STRSXP, n)); SET_SLOT(dest, s_type, type); - PROTECT(name = allocVector(STRSXP, n)); + PROTECT(name = Rf_allocVector(STRSXP, n)); SET_SLOT(dest, s_name, name); filemode_ptr = INTEGER(filemode); @@ -191,21 +191,21 @@ SEXP git2r_tree_walk(SEXP tree, SEXP recursive) if (err) goto cleanup; - PROTECT(result = allocVector(VECSXP, 6)); + PROTECT(result = Rf_allocVector(VECSXP, 6)); nprotect++; - setAttrib(result, R_NamesSymbol, names = allocVector(STRSXP, 6)); + setAttrib(result, R_NamesSymbol, names = Rf_allocVector(STRSXP, 6)); - SET_VECTOR_ELT(result, 0, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, 0, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, 0, mkChar("mode")); - SET_VECTOR_ELT(result, 1, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, 1, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, 1, mkChar("type")); - SET_VECTOR_ELT(result, 2, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, 2, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, 2, mkChar("sha")); - SET_VECTOR_ELT(result, 3, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, 3, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, 3, mkChar("path")); - SET_VECTOR_ELT(result, 4, allocVector(STRSXP, cb_data.n)); + SET_VECTOR_ELT(result, 4, Rf_allocVector(STRSXP, cb_data.n)); SET_STRING_ELT(names, 4, mkChar("name")); - SET_VECTOR_ELT(result, 5, allocVector(INTSXP, cb_data.n)); + SET_VECTOR_ELT(result, 5, Rf_allocVector(INTSXP, cb_data.n)); SET_STRING_ELT(names, 5, mkChar("len")); cb_data.list = result;