[Rcpp-devel] [Rcpp-commits] r269 - in pkg: inst inst/unitTests src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 4 19:38:49 CET 2010


Author: romain
Date: 2010-01-04 19:38:49 +0100 (Mon, 04 Jan 2010)
New Revision: 269

Modified:
   pkg/inst/ChangeLog
   pkg/inst/unitTests/runit.Language.R
   pkg/src/wrap.cpp
Log:
added some PROTECT, use verbose=FALSE in cfunction

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2010-01-04 18:28:49 UTC (rev 268)
+++ pkg/inst/ChangeLog	2010-01-04 18:38:49 UTC (rev 269)
@@ -8,6 +8,11 @@
 	
 	* src/unitTests/runit.environments.R: remove unit test
 
+	* src/unitTests/runit.Language.R: remove verbose=TRUE in cfunction
+	call (generated noise)
+
+	* src/wrap.cpp: added a few missing PROTECT 
+	
 2010-01-04  Dirk Eddelbuettel  <edd at debian.org>
 
 	* src/excections.cpp: Get rid of another unused variable

Modified: pkg/inst/unitTests/runit.Language.R
===================================================================
--- pkg/inst/unitTests/runit.Language.R	2010-01-04 18:28:49 UTC (rev 268)
+++ pkg/inst/unitTests/runit.Language.R	2010-01-04 18:38:49 UTC (rev 269)
@@ -38,13 +38,13 @@
 	if( Rcpp:::canUseCXX0X() ){
 		funx <- cfunction(signature(), '
 		return Language( "rnorm", 10, 0.0, 2.0 ) ;
-		', Rcpp=TRUE, verbose=TRUE, includes = "using namespace Rcpp;" )
+		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
 		checkEquals( funx(), call("rnorm", 10L, 0.0, 2.0 ), 
 			msg = "variadic templates" )
 			
 		funx <- cfunction(signature(), '
 		return Language( "rnorm", 10, Named("mean",0.0), 2.0 ) ;
-		', Rcpp=TRUE, verbose=TRUE, includes = "using namespace Rcpp;" )
+		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
 		checkEquals( funx(), call("rnorm", 10L, mean = 0.0, 2.0 ), 
 			msg = "variadic templates (with names)" )
 	}

Modified: pkg/src/wrap.cpp
===================================================================
--- pkg/src/wrap.cpp	2010-01-04 18:28:49 UTC (rev 268)
+++ pkg/src/wrap.cpp	2010-01-04 18:38:49 UTC (rev 269)
@@ -132,7 +132,7 @@
 RObject wrap(const std::set<int> & v){
     logTxt("RObject from set<int>\n");
     int n = v.size();
-    SEXP m_sexp = Rf_allocVector(INTSXP, n);
+    SEXP m_sexp = PROTECT( Rf_allocVector(INTSXP, n) );
     copy( v.begin(), v.end(), INTEGER(m_sexp) ) ;
     RObject o(m_sexp) ;
     UNPROTECT(1) ;
@@ -142,7 +142,7 @@
 RObject wrap(const std::set<double> & v){
     logTxt("RObject from set<double>\n");
     int n = v.size();
-    SEXP m_sexp = Rf_allocVector(REALSXP, n);
+    SEXP m_sexp = PROTECT( Rf_allocVector(REALSXP, n) );
     copy( v.begin(), v.end(), REAL(m_sexp) ) ;
     RObject o(m_sexp) ;
     UNPROTECT(1) ;
@@ -152,7 +152,7 @@
 RObject wrap(const std::set<Rbyte> & v){
     logTxt("RObject from set<Rbyte> \n");
     int n = v.size();
-    SEXP m_sexp = Rf_allocVector(RAWSXP, n);
+    SEXP m_sexp = PROTECT( Rf_allocVector(RAWSXP, n) );
     copy( v.begin(), v.end(), RAW(m_sexp) ) ;
     RObject o(m_sexp) ;
     UNPROTECT(1) ;
@@ -162,7 +162,7 @@
 RObject wrap(const std::set<std::string> & v){
     logTxt("RObject from set<string>\n");
     int n = v.size();
-    SEXP m_sexp = Rf_allocVector(STRSXP, n);
+    SEXP m_sexp = PROTECT( Rf_allocVector(STRSXP, n) );
     int i=0;
     std::set<std::string>::iterator it = v.begin(); 
     while( i<n ){

_______________________________________________
Rcpp-commits mailing list
Rcpp-commits at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-commits


More information about the Rcpp-devel mailing list