Skip to content

Commit

Permalink
chore: R 4.0 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Mar 6, 2025
1 parent d64ef7a commit c473da5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rinterface_extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -8657,6 +8657,7 @@ SEXP R_igraph_add_env(SEXP graph) {
SET_CLASS(result, Rf_duplicate(GET_CLASS(graph)));
}

#if defined(R_VERSION) && R_VERSION >= R_Version(4, 1, 0)
// Get the base namespace
SEXP base_ns = PROTECT(R_FindNamespace(Rf_mkString("base"))); px++;
// Get the emptyenv function
Expand All @@ -8665,6 +8666,9 @@ SEXP R_igraph_add_env(SEXP graph) {
SEXP empty_env = PROTECT(Rf_eval(Rf_lang1(empty_env_fun), R_GlobalEnv)); px++;
// Evaluate the call
SEXP env = PROTECT(R_NewEnv(empty_env, 0, 0)); px++;
#else
SEXP env = Rf_allocSExp(ENVSXP);
#endif

SET_VECTOR_ELT(result, igraph_t_idx_env, env);

Expand Down

0 comments on commit c473da5

Please sign in to comment.