Skip to content

Commit 320b03b

Browse files
committed
suggested fix for maacheck (closes #685)
1 parent feb4d7a commit 320b03b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2017-04-26 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/include/Rcpp/exceptions.h (string_to_try_error): Protect result
4+
from Rf_mkString
5+
16
2017-04-25 Dirk Eddelbuettel <[email protected]>
27

38
* R/Attributes.R (.plugins[["cpp11"]]): If R 3.4.0 or newer is used, set

inst/include/Rcpp/exceptions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ inline SEXP string_to_try_error( const std::string& str){
291291
using namespace Rcpp;
292292

293293
#ifndef RCPP_USING_UTF8_ERROR_STRING
294-
Rcpp::Shield<SEXP> simpleErrorExpr( Rf_lang2(::Rf_install("simpleError"), Rf_mkString(str.c_str())) );
294+
Rcpp::Shield<SEXP> txt(Rf_mkString(str.c_str()));
295+
Rcpp::Shield<SEXP> simpleErrorExpr(Rf_lang2(::Rf_install("simpleError"), txt));
295296
Rcpp::Shield<SEXP> tryError( Rf_mkString( str.c_str() ) );
296297
#else
297298
Rcpp::Shield<SEXP> tryError( Rf_allocVector( STRSXP, 1 ) ) ;

0 commit comments

Comments
 (0)