Skip to content

Commit

Permalink
chore: Remove Rf_allocSExp() which is no longer in R's C API (#1735)
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr authored Mar 6, 2025
1 parent f3f1b21 commit d64ef7a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/rinterface_extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -8657,7 +8657,16 @@ SEXP R_igraph_add_env(SEXP graph) {
SET_CLASS(result, Rf_duplicate(GET_CLASS(graph)));
}

SET_VECTOR_ELT(result, igraph_t_idx_env, Rf_allocSExp(ENVSXP));
// Get the base namespace
SEXP base_ns = PROTECT(R_FindNamespace(Rf_mkString("base"))); px++;
// Get the emptyenv function
SEXP empty_env_fun = PROTECT(Rf_findVarInFrame(base_ns, Rf_install("emptyenv"))); px++;
// Call emptyenv()
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++;

SET_VECTOR_ELT(result, igraph_t_idx_env, env);

uuid_generate(my_id);
uuid_unparse_lower(my_id, my_id_chr);
Expand Down

0 comments on commit d64ef7a

Please sign in to comment.