Skip to content

Commit 7e0218c

Browse files
committed
Code smell (protect result of Rf_mkString)
1 parent 72f368e commit 7e0218c

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+
2014-05-28 Kevin Ushey <[email protected]>
2+
3+
* inst/include/Rcpp/vector/vector_from_string.h: Protect result of
4+
Rf_mkString
5+
16
2014-05-23 Dirk Eddelbuettel <[email protected]>
27

38
* R/Module.R (new_dummyObject): Remove erraneous quotes

inst/include/Rcpp/vector/vector_from_string.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ namespace internal{
2727

2828
template <int RTYPE>
2929
inline SEXP vector_from_string( const std::string& st ) {
30-
return r_cast<RTYPE>( Rf_mkString( st.c_str() ) ) ;
30+
Shield<SEXP> str(Rf_mkString(st.c_str()));
31+
return r_cast<RTYPE>(str) ;
3132
}
3233

3334
template <int RTYPE>

0 commit comments

Comments
 (0)