From 1aa470c2c435c32e275533d3e936ed3927c51218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Tue, 23 Apr 2024 11:09:10 +0200 Subject: [PATCH] Use R_NewEnv on R >= 4.1 to avoid non-api warnings --- src/progress.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/progress.c b/src/progress.c index b0544ca46..84bb099a4 100644 --- a/src/progress.c +++ b/src/progress.c @@ -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; }