diff --git a/src/rinterface.h b/src/rinterface.h index 3a164ee9da..dada9a184b 100644 --- a/src/rinterface.h +++ b/src/rinterface.h @@ -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(); \ diff --git a/src/rinterface_extra.c b/src/rinterface_extra.c index 9a529966b0..ed58f22132 100644 --- a/src/rinterface_extra.c +++ b/src/rinterface_extra.c @@ -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) {