Skip to content

Commit

Permalink
Switch from vec_is_vector() to obj_is_vector() (#6729)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan committed Feb 15, 2023
1 parent bb1a379 commit 2f2bd2a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/dplyr.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void env_unbind(SEXP, SEXP);
}

namespace vctrs {
bool vec_is_vector(SEXP x) ;
bool obj_is_vector(SEXP x) ;
R_len_t short_vec_size(SEXP x) ;
SEXP short_vec_recycle(SEXP x, R_len_t n);

Expand Down
8 changes: 4 additions & 4 deletions src/imports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ namespace vctrs {

// *INDENT-OFF*
struct vctrs_api_ptrs_t {
bool (*vec_is_vector)(SEXP x);
bool (*obj_is_vector)(SEXP x);
R_len_t (*short_vec_size)(SEXP x);
SEXP (*short_vec_recycle)(SEXP, R_len_t);

vctrs_api_ptrs_t() {
vec_is_vector = (bool (*)(SEXP)) R_GetCCallable("vctrs", "vec_is_vector");
obj_is_vector = (bool (*)(SEXP)) R_GetCCallable("vctrs", "obj_is_vector");
short_vec_size = (R_len_t (*)(SEXP)) R_GetCCallable("vctrs", "short_vec_size");
short_vec_recycle = (SEXP (*)(SEXP, R_len_t)) R_GetCCallable("vctrs", "short_vec_recycle");
}
Expand All @@ -74,8 +74,8 @@ const vctrs_api_ptrs_t& vctrs_api() {
return ptrs;
}

bool vec_is_vector(SEXP x) {
return vctrs_api().vec_is_vector(x);
bool obj_is_vector(SEXP x) {
return vctrs_api().obj_is_vector(x);
}

R_len_t short_vec_size(SEXP x) {
Expand Down
2 changes: 1 addition & 1 deletion src/mutate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SEXP dplyr_mask_eval_all_mutate(SEXP quo, SEXP env_private) {
dplyr::stop_mutate_mixed_null();
}

} else if (vctrs::vec_is_vector(result_i)) {
} else if (vctrs::obj_is_vector(result_i)) {
seen_vec = true;

R_len_t n_result_i = vctrs::short_vec_size(result_i);
Expand Down
2 changes: 1 addition & 1 deletion src/summarise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SEXP dplyr_mask_eval_all_summarise(SEXP quo, SEXP env_private) {

if (result_i == R_NilValue) {
n_null++;
} else if (!vctrs::vec_is_vector(result_i)) {
} else if (!vctrs::obj_is_vector(result_i)) {
dplyr::stop_summarise_unsupported_type(result_i);
}

Expand Down

0 comments on commit 2f2bd2a

Please sign in to comment.