[Rcpp-commits] r1673 - pkg/Rcpp/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 23 15:52:32 CEST 2010


Author: romain
Date: 2010-06-23 15:52:32 +0200 (Wed, 23 Jun 2010)
New Revision: 1673

Modified:
   pkg/Rcpp/src/Date.cpp
Log:
using Rf_mkString

Modified: pkg/Rcpp/src/Date.cpp
===================================================================
--- pkg/Rcpp/src/Date.cpp	2010-06-23 13:46:04 UTC (rev 1672)
+++ pkg/Rcpp/src/Date.cpp	2010-06-23 13:52:32 UTC (rev 1673)
@@ -69,10 +69,8 @@
     template <> SEXP wrap(const Date &date) {
 	SEXP value = PROTECT(Rf_allocVector(REALSXP, 1));
 	REAL(value)[0] = date.getDate();
-	SEXP dateclass = PROTECT(Rf_allocVector(STRSXP,1));
-	SET_STRING_ELT(dateclass, 0, Rf_mkChar("Date"));
-	Rf_setAttrib(value, R_ClassSymbol, dateclass); 
-	UNPROTECT(2);
+	Rf_setAttrib(value, R_ClassSymbol, Rf_mkString("Date") ); 
+	UNPROTECT(1);
 	return value;
     }
 



More information about the Rcpp-commits mailing list