Skip to content

use documented R API function for extptr addr #1098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2020-07-06 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Version, Date): Roll minor version
* inst/include/Rcpp/config.h: Idem

2020-07-06 Kevin Ushey <kevinushey@gmail.com>

* inst/include/Rcpp/module/class.h: EXTPTR_PTR -> R_ExternalPtrAddr
* src/api.cpp: Idem
* src/module.cpp: Idem

2020-07-01 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Date, Version): Release 1.0.5
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: Rcpp
Title: Seamless R and C++ Integration
Version: 1.0.5
Date: 2020-07-01
Version: 1.0.5.1
Date: 2020-07-06
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey, Qiang Kou,
Nathan Russell, Douglas Bates and John Chambers
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Expand Down
11 changes: 11 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
\newcommand{\ghpr}{\href{https://github.com/RcppCore/Rcpp/pull/#1}{##1}}
\newcommand{\ghit}{\href{https://github.com/RcppCore/Rcpp/issues/#1}{##1}}

\section{Changes in Rcpp patch release version 1.0.6 (2021-01-xx)}{
\itemize{
\item Changes in Rcpp API:
\itemize{
\item Replace remaining few uses of \code{EXTPTR_PTR} with
\code{R_ExternalPtrAddr} (Kevin in \ghpr{1098} fixing
\ghit{1097}).
}
}
}

\section{Changes in Rcpp patch release version 1.0.5 (2020-07-01)}{
\itemize{
\item Changes in Rcpp API:
Expand Down
4 changes: 2 additions & 2 deletions inst/include/Rcpp/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define RCPP_VERSION_STRING "1.0.5"

// the current source snapshot
#define RCPP_DEV_VERSION RcppDevVersion(1,0,5,0)
#define RCPP_DEV_VERSION_STRING "1.0.5"
#define RCPP_DEV_VERSION RcppDevVersion(1,0,5,1)
#define RCPP_DEV_VERSION_STRING "1.0.5.1"

#endif
10 changes: 5 additions & 5 deletions inst/include/Rcpp/module/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
SEXP invoke( SEXP method_xp, SEXP object, SEXP *args, int nargs ){
BEGIN_RCPP

vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( EXTPTR_PTR( method_xp ) ) ;
vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( R_ExternalPtrAddr( method_xp ) ) ;
typename vec_signed_method::iterator it = mets->begin() ;
int n = mets->size() ;
method_class* m = 0 ;
Expand All @@ -194,7 +194,7 @@
SEXP invoke_void( SEXP method_xp, SEXP object, SEXP *args, int nargs ){
BEGIN_RCPP

vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( EXTPTR_PTR( method_xp ) ) ;
vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( R_ExternalPtrAddr( method_xp ) ) ;
typename vec_signed_method::iterator it = mets->begin() ;
int n = mets->size() ;
method_class* m = 0 ;
Expand All @@ -216,7 +216,7 @@
SEXP invoke_notvoid( SEXP method_xp, SEXP object, SEXP *args, int nargs ){
BEGIN_RCPP

vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( EXTPTR_PTR( method_xp ) ) ;
vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( R_ExternalPtrAddr( method_xp ) ) ;
typename vec_signed_method::iterator it = mets->begin() ;
int n = mets->size() ;
method_class* m = 0 ;
Expand Down Expand Up @@ -393,14 +393,14 @@

SEXP getProperty( SEXP field_xp , SEXP object) {
BEGIN_RCPP
prop_class* prop = reinterpret_cast< prop_class* >( EXTPTR_PTR( field_xp ) ) ;
prop_class* prop = reinterpret_cast< prop_class* >( R_ExternalPtrAddr( field_xp ) ) ;
return prop->get( XP(object) );
END_RCPP
}

void setProperty( SEXP field_xp, SEXP object, SEXP value) {
BEGIN_RCPP
prop_class* prop = reinterpret_cast< prop_class* >( EXTPTR_PTR( field_xp ) ) ;
prop_class* prop = reinterpret_cast< prop_class* >( R_ExternalPtrAddr( field_xp ) ) ;
return prop->set( XP(object), value );
VOID_END_RCPP
}
Expand Down
2 changes: 1 addition & 1 deletion src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const char* short_file_name(const char* file) { // #nocov start
// [[Rcpp::internal]]
SEXP as_character_externalptr(SEXP xp) {
char buffer[20];
snprintf(buffer, 20, "%p", (void*)EXTPTR_PTR(xp));
snprintf(buffer, 20, "%p", (void*)R_ExternalPtrAddr(xp));
return Rcpp::wrap((const char*)buffer);
} // #nocov end

Expand Down
2 changes: 1 addition & 1 deletion src/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ RCPP_FUN_2(Rcpp::CppClass, Module__get_class, XP_Module module, std::string cl)
return module->get_class(cl);
}
RCPP_FUN_1(bool, CppObject__needs_init, SEXP xp) { // #nocov start
return EXTPTR_PTR(xp) == 0;
return R_ExternalPtrAddr(xp) == 0;
}
RCPP_FUN_1(Rcpp::CharacterVector, CppClass__methods, XP_Class cl) {
return cl->method_names();
Expand Down