[Rcpp-commits] r2210 - in pkg/Rcpp: inst/include/Rcpp/internal inst/include/Rcpp/traits inst/include/Rcpp/vector src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 27 15:18:58 CEST 2010


Author: romain
Date: 2010-09-27 15:18:58 +0200 (Mon, 27 Sep 2010)
New Revision: 2210

Modified:
   pkg/Rcpp/inst/include/Rcpp/internal/wrap.h
   pkg/Rcpp/inst/include/Rcpp/traits/Exporter.h
   pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h
   pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
   pkg/Rcpp/src/S4.cpp
Log:
using some known symbols instead of Rf_install ing them

Modified: pkg/Rcpp/inst/include/Rcpp/internal/wrap.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/internal/wrap.h	2010-09-27 13:11:10 UTC (rev 2209)
+++ pkg/Rcpp/inst/include/Rcpp/internal/wrap.h	2010-09-27 13:18:58 UTC (rev 2210)
@@ -461,7 +461,7 @@
 	SEXP dim = PROTECT( Rf_allocVector( INTSXP, 2) ) ;
 	INTEGER(dim)[0] = object.nrow() ;
 	INTEGER(dim)[1] = object.ncol() ;
-	Rf_setAttrib( res, Rf_install( "dim" ), dim ) ;
+	Rf_setAttrib( res, R_DimSymbol , dim ) ;
 	UNPROTECT(2) ;
 	return res ;
 }

Modified: pkg/Rcpp/inst/include/Rcpp/traits/Exporter.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/Exporter.h	2010-09-27 13:11:10 UTC (rev 2209)
+++ pkg/Rcpp/inst/include/Rcpp/traits/Exporter.h	2010-09-27 13:18:58 UTC (rev 2210)
@@ -81,7 +81,7 @@
 	~MatrixExporter(){}
 	
 	T get() throw(::Rcpp::not_a_matrix) {
-		SEXP dims = PROTECT( ::Rf_getAttrib( object, Rf_install("dim") ) ) ;
+		SEXP dims = PROTECT( ::Rf_getAttrib( object, R_DimSymbol ) ) ;
 		if( dims == R_NilValue || ::Rf_length(dims) != 2 ){
 			throw ::Rcpp::not_a_matrix() ;
 		}

Modified: pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h	2010-09-27 13:11:10 UTC (rev 2209)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h	2010-09-27 13:18:58 UTC (rev 2210)
@@ -79,7 +79,7 @@
     	SEXP d = PROTECT( Rf_allocVector( INTSXP, 2) ) ;
     	INTEGER(d)[0] = nr ;
     	INTEGER(d)[1] = nc ;
-    	Rf_setAttrib( x, Rf_install("dim"), d ) ;
+    	Rf_setAttrib( x, R_DimSymbol, d ) ;
     	RObject::setSEXP( x ) ;
     	UNPROTECT( 2 ) ;
     	import_matrix_expression<NA,MAT>( other, nr, nc ) ;

Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Vector.h	2010-09-27 13:11:10 UTC (rev 2209)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Vector.h	2010-09-27 13:18:58 UTC (rev 2210)
@@ -784,7 +784,7 @@
 protected:
 	inline int* dims() const throw(not_a_matrix) {
 		if( !::Rf_isMatrix(RObject::m_sexp) ) throw not_a_matrix() ;
-		return INTEGER( ::Rf_getAttrib( RObject::m_sexp, ::Rf_install( "dim") ) ) ;
+		return INTEGER( ::Rf_getAttrib( RObject::m_sexp, R_DimSymbol ) ) ;
 	}
 	
 } ; /* Vector */

Modified: pkg/Rcpp/src/S4.cpp
===================================================================
--- pkg/Rcpp/src/S4.cpp	2010-09-27 13:11:10 UTC (rev 2209)
+++ pkg/Rcpp/src/S4.cpp	2010-09-27 13:18:58 UTC (rev 2210)
@@ -75,7 +75,7 @@
 			// 
 			CharacterVector res = internal::try_catch( 
 				Rf_lang2(
-					Rf_install( "names" ),
+					R_NamesSymbol,
 					Rf_lang3( 
 						Rf_install( "slot" ),
 						Rf_lang2( Rf_install( "getClassDef"), cl ), 



More information about the Rcpp-commits mailing list