[Rcpp-commits] r2892 - in pkg/Rcpp: . inst/include/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Feb 11 00:29:23 CET 2011


Author: dmbates
Date: 2011-02-11 00:29:22 +0100 (Fri, 11 Feb 2011)
New Revision: 2892

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/XPtr.h
Log:
Replace calls to EXTPTR_PTR with R_ExternalPtrAddr


Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2011-02-05 20:36:24 UTC (rev 2891)
+++ pkg/Rcpp/ChangeLog	2011-02-10 23:29:22 UTC (rev 2892)
@@ -1,3 +1,9 @@
+2011-02-10  Douglas Bates  <bates at stat.wisc.edu>
+
+	* inst/include/Rcpp/XPtr.h: Replace calls to EXTPTR_PTR with
+	R_ExternalPtrAddr.  The distinction is important when R is
+	compiled with PROTECTCHECK enabled.
+
 2011-02-01  Romain Francois <romain at r-enthusiasts.com>
 
 	* inst/include/Rcpp/vector/Vector.h: extra PROTECT'ion in several places

Modified: pkg/Rcpp/inst/include/Rcpp/XPtr.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/XPtr.h	2011-02-05 20:36:24 UTC (rev 2891)
+++ pkg/Rcpp/inst/include/Rcpp/XPtr.h	2011-02-10 23:29:22 UTC (rev 2892)
@@ -29,7 +29,7 @@
 template <typename T>
 void delete_finalizer(SEXP p){
     if( TYPEOF(p) == EXTPTRSXP ){
-	T* ptr = (T*) EXTPTR_PTR(p) ;
+	T* ptr = (T*) R_ExternalPtrAddr(p) ;
 	delete ptr ;
     }
 }
@@ -82,7 +82,7 @@
   		  		        
     void setDeleteFinalizer() ;
   	
-    inline operator T*(){ return (T*)(EXTPTR_PTR(m_sexp)) ; }
+    inline operator T*(){ return (T*)( R_ExternalPtrAddr(m_sexp)) ; }
 
     class TagProxy{
     public:
@@ -168,12 +168,12 @@
 
 template<typename T>
 T& XPtr<T>::operator*() const {
-    return *((T*)EXTPTR_PTR( m_sexp )) ;
+    return *((T*)R_ExternalPtrAddr( m_sexp )) ;
 }
 
 template<typename T>
 T* XPtr<T>::operator->() const {
-    return (T*)(EXTPTR_PTR(m_sexp));
+    return (T*)(R_ExternalPtrAddr(m_sexp));
 }
 
 } // namespace Rcpp 



More information about the Rcpp-commits mailing list