Skip to content

Commit

Permalink
chore: Remove function not in the C API
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Mar 6, 2025
1 parent e367ee3 commit 1c55be5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/rinterface_extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -8657,7 +8657,19 @@ SEXP R_igraph_add_env(SEXP graph) {
SET_CLASS(result, Rf_duplicate(GET_CLASS(graph)));
}

SEXP env = Rf_allocSExp(ENVSXP);
// Get the base namespace
SEXP base_ns = PROTECT(R_FindNamespace(Rf_mkString("base"))); px++;
// Get the new.environment function
SEXP new_env_fun = PROTECT(Rf_findVarInFrame(base_ns, Rf_install("new.environment"))); 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++;
// Create environment with parent = emptyenv()
SEXP call = PROTECT(Rf_lang3(new_env_fun, Rf_install("parent"), empty_env)); px++;
// Evaluate the call
SEXP env = PROTECT(Rf_eval(call, R_GlobalEnv)); px++;

SET_VECTOR_ELT(result, igraph_t_idx_env, env);

uuid_generate(my_id);
Expand Down

0 comments on commit 1c55be5

Please sign in to comment.