Skip to content

Commit

Permalink
chore: clarify use of scalar check functions/macros
Browse files Browse the repository at this point in the history
  • Loading branch information
szhorvat authored and aviator-bot committed Jan 1, 2024
1 parent 6a7b8be commit 3b545ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ igraph_error_t R_SEXP_to_igraph_eigen_which(SEXP in, igraph_eigen_which_t *out);
void R_SEXP_to_igraph_arpack_options(SEXP in, igraph_arpack_options_t *opt);
igraph_error_t R_SEXP_to_attr_comb(SEXP input, igraph_attribute_combination_t *comb);

/* The following IGRAPH_R_... macros must only be called from top-level C code,
* i.e. in C functions which are called from R directly. */

#define IGRAPH_R_CHECK(func) \
do { \
R_igraph_attribute_clean_preserve_list(); \
Expand Down
3 changes: 3 additions & 0 deletions src/rinterface_extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ enum igraph_versions {

#define R_IGRAPH_VERSION_VAR ".__igraph_version__."

/* The following three R_check_... functions must only be called from top-level C code,
* i.e. in contexts where igraph_error() does NOT return. */

void R_check_int_scalar(SEXP value)
{
if (Rf_xlength(value) != 1) {
Expand Down

0 comments on commit 3b545ad

Please sign in to comment.