[Rcpp-commits] r2877 - in pkg/Rcpp: . src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jan 22 19:09:26 CET 2011
Author: edd
Date: 2011-01-22 19:09:26 +0100 (Sat, 22 Jan 2011)
New Revision: 2877
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/src/Function.cpp
Log:
assign Rf_install to local SEXP in a few places
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2011-01-22 17:39:50 UTC (rev 2876)
+++ pkg/Rcpp/ChangeLog 2011-01-22 18:09:26 UTC (rev 2877)
@@ -1,6 +1,7 @@
2011-01-22 Dirk Eddelbuettel <edd at debian.org>
- * src/RObject.cpp: Assign Rf_install() result to local SEXP
+ * src/Function.cpp: Assign Rf_install() result to local SEXP
+ * src/RObject.cpp: idem
* src/Symbol.cpp: idem
2011-01-13 Douglas Bates <bates at stat.wisc.edu>
Modified: pkg/Rcpp/src/Function.cpp
===================================================================
--- pkg/Rcpp/src/Function.cpp 2011-01-22 17:39:50 UTC (rev 2876)
+++ pkg/Rcpp/src/Function.cpp 2011-01-22 18:09:26 UTC (rev 2877)
@@ -36,9 +36,10 @@
}
Function::Function(const std::string& name) throw(no_such_function) : RObject() {
- SEXP x = PROTECT( Rf_findFun( Rf_install(name.c_str()), R_GlobalEnv ) ) ;
- setSEXP( x ) ;
- UNPROTECT(1) ;
+ SEXP nameSym = Rf_install( name.c_str() ); // cannot be gc()'ed once in symbol table
+ SEXP x = PROTECT( Rf_findFun( nameSym, R_GlobalEnv ) ) ;
+ setSEXP( x ) ;
+ UNPROTECT(1) ;
}
Function::Function(const Function& other) : RObject(){
More information about the Rcpp-commits
mailing list