Skip to content

Commit 674c40e

Browse files
committed
Merge pull request #332 from RcppCore/feature/rf_installchar
use Rf_installChar() for R 3.2.0 or newer (closes #331)
2 parents 3bd9606 + 30642ee commit 674c40e

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2015-07-23 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/include/Rcpp/Symbol.h: Use Rf_installChar(x) instead of
4+
Rf_install(CHAR(X)) if R 3.2.0 or later is used
5+
16
2015-07-07 Qiang Kou <[email protected]>
27

38
* src/include/Rcpp/String.h: Ensure proper initialization of String

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: Rcpp
22
Title: Seamless R and C++ Integration
3-
Version: 0.11.6.4.2
4-
Date: 2015-07-21
3+
Version: 0.11.6.4.3
4+
Date: 2015-07-23
55
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey,
66
Douglas Bates, and John Chambers
77
Maintainer: Dirk Eddelbuettel <[email protected]>

inst/NEWS.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
request 322 and 329 by Qiang Kou)
2525
\item DataFrame constructors are now a little more careful (via pull
2626
request 301 by Romain Francois)
27+
\item For R 3.2.0 or newer, \code{Rf_installChar()} is used instead of
28+
\code{Rf_install(CHAR())}.
2729
}
2830
\item Changes in Rcpp Attributes:
2931
\itemize{

inst/include/Rcpp/Symbol.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// Symbol.h: Rcpp R/C++ interface class library -- access R environments
44
//
5-
// Copyright (C) 2013 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2013 - 2015 Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -43,13 +43,21 @@ namespace Rcpp{
4343
Storage::set__( x ) ;
4444
break; /* nothing to do */
4545
case CHARSXP: {
46+
#if R_VERSION >= R_Version(3,2,0)
47+
SEXP charSym = Rf_installChar(x); // R 3.2.0 or later have Rf_installChar
48+
#else
4649
SEXP charSym = Rf_install(CHAR(x)); // cannot be gc()'ed once in symbol table
50+
#endif
4751
Storage::set__( charSym ) ;
4852
break ;
4953
}
5054
case STRSXP: {
5155
/* FIXME: check that there is at least one element */
56+
#if R_VERSION >= R_Version(3,2,0)
57+
SEXP charSym = Rf_installChar(STRING_ELT(x, 0 )); // R 3.2.0 or later have Rf_installChar
58+
#else
5259
SEXP charSym = Rf_install( CHAR(STRING_ELT(x, 0 )) ); // cannot be gc()'ed once in symbol table
60+
#endif
5361
Storage::set__( charSym );
5462
break ;
5563
}

0 commit comments

Comments
 (0)