Skip to content

Commit

Permalink
Use R_NewEnv on R >= 4.1 to avoid non-api warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Apr 23, 2024
1 parent a966d94 commit 1aa470c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ static int cli_clock_gettime(int clk_id, struct timespec *t) {

static R_INLINE SEXP new_env(void) {
SEXP env;
#if R_VERSION >= R_Version(4, 1, 0)
PROTECT(env = R_NewEnv(R_EmptyEnv, 1, 29));
#else
PROTECT(env = allocSExp(ENVSXP));
SET_FRAME(env, R_NilValue);
SET_ENCLOS(env, R_EmptyEnv);
SET_HASHTAB(env, R_NilValue);
SET_ATTRIB(env, R_NilValue);
#endif
UNPROTECT(1);
return env;
}
Expand Down

0 comments on commit 1aa470c

Please sign in to comment.