Skip to content

Commit 03db1f7

Browse files
committed
Use R_ClosureEnv instead of CLOENV with R (>= 4.5.0)
1 parent b8d393a commit 03db1f7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

inst/include/Rcpp/Function.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ namespace Rcpp{
9999
if( TYPEOF(fun) != CLOSXP ) {
100100
throw not_a_closure(Rf_type2char(TYPEOF(fun)));
101101
}
102-
return CLOENV(fun) ;
102+
#if (defined(R_VERSION) && R_VERSION >= R_Version(4,5,0))
103+
return R_ClosureEnv(fun);
104+
#else
105+
return CLOENV(fun);
106+
#endif
103107
}
104108

105109
/**

inst/include/Rcpp/Symbol.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace Rcpp{
4343
Storage::set__( x ) ;
4444
break; /* nothing to do */
4545
case CHARSXP: {
46-
#if R_VERSION >= R_Version(3,2,0)
46+
#if R_VERSION >= R_Version(3,2,0)
4747
SEXP charSym = Rf_installChar(x); // R 3.2.0 or later have Rf_installChar
4848
#else
4949
SEXP charSym = Rf_install(CHAR(x)); // cannot be gc()'ed once in symbol table
@@ -53,7 +53,7 @@ namespace Rcpp{
5353
}
5454
case STRSXP: {
5555
/* FIXME: check that there is at least one element */
56-
#if R_VERSION >= R_Version(3,2,0)
56+
#if R_VERSION >= R_Version(3,2,0)
5757
SEXP charSym = Rf_installChar(STRING_ELT(x, 0 )); // R 3.2.0 or later have Rf_installChar
5858
#else
5959
SEXP charSym = Rf_install( CHAR(STRING_ELT(x, 0 )) ); // cannot be gc()'ed once in symbol table

0 commit comments

Comments
 (0)