Skip to content

Commit f479791

Browse files
committed
two more Shield<SEXP> uses
1 parent 9bf01e7 commit f479791

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2020-03-24 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/include/Rcpp/Environment.h: Added two Shield<SEXP> wrappers
4+
around Rf_langX calls
5+
16
2020-03-23 Dirk Eddelbuettel <[email protected]>
27

38
* .travis.yml (script): Run coverage as parallel step

inst/include/Rcpp/Environment.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Environment.h: Rcpp R/C++ interface class library -- access R environments
44
//
55
// Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois
6-
// Copyright (C) 2014 - 2019 Dirk Eddelbuettel, Romain Francois and Kevin Ushey
6+
// Copyright (C) 2014 - 2020 Dirk Eddelbuettel, Romain Francois and Kevin Ushey
77
//
88
// This file is part of Rcpp.
99
//
@@ -33,8 +33,8 @@ namespace Rcpp{
3333
if( Rf_isEnvironment(x) ) return x ;
3434
SEXP asEnvironmentSym = Rf_install("as.environment");
3535
try {
36-
Shield<SEXP> res(Rcpp_fast_eval(Rf_lang2(asEnvironmentSym, x), R_GlobalEnv));
37-
return res ;
36+
Shield<SEXP> call(Rf_lang2(asEnvironmentSym, x));
37+
return Rcpp_fast_eval(call, R_GlobalEnv);
3838
} catch( const eval_error& ex) {
3939
const char* fmt = "Cannot convert object to an environment: "
4040
"[type=%s; target=ENVSXP].";
@@ -393,10 +393,10 @@ namespace Rcpp{
393393
*/
394394
Environment_Impl new_child(bool hashed) const {
395395
SEXP newEnvSym = Rf_install("new.env");
396-
return Environment_Impl(Rcpp_fast_eval(Rf_lang3(newEnvSym, Rf_ScalarLogical(hashed), Storage::get__()), R_GlobalEnv));
396+
Shield<SEXP> call(Rf_lang3(newEnvSym, Rf_ScalarLogical(hashed), Storage::get__()));
397+
return Environment_Impl(Rcpp_fast_eval(call, R_GlobalEnv));
397398
}
398399

399-
400400
void update(SEXP){}
401401
};
402402

0 commit comments

Comments
 (0)