Skip to content

Commit 049ecfd

Browse files
committed
clean up some more usages
1 parent 69d2c94 commit 049ecfd

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

ChangeLog

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
2017-12-04 Kevin Ushey <[email protected]>
22

3-
* inst/include/Rcpp/api/meat/proxy.h: Protect temporary SEXP
3+
* inst/include/Rcpp/RObject.h: Protect temporary wrapped SEXPs
4+
* inst/include/Rcpp/api/meat/DataFrame.h: Idem
5+
* inst/include/Rcpp/api/meat/Environment.h: Idem
6+
* inst/include/Rcpp/api/meat/proxy.h: Idem
47
* inst/include/Rcpp/proxy/ProtectedProxy.h: Idem
58
* inst/include/Rcpp/vector/generic_proxy.h: Idem
69

inst/include/Rcpp/RObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace Rcpp{
4848
*/
4949
template <typename T>
5050
RObject_Impl& operator=(const T& other) {
51-
Storage::set__( wrap(other) ) ;
51+
Storage::set__(Shield<SEXP>(wrap(other)));
5252
return *this;
5353
}
5454

inst/include/Rcpp/api/meat/DataFrame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Rcpp{
2323
template <template <class> class StoragePolicy>
2424
template <class T>
2525
DataFrame_Impl<StoragePolicy>::DataFrame_Impl( const T& obj){
26-
set__( wrap(obj) ) ;
26+
set__(Shield<SEXP>(wrap(obj)));
2727
}
2828

2929
}

inst/include/Rcpp/api/meat/Environment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Rcpp{
2727
template <template <class> class StoragePolicy>
2828
template <typename WRAPPABLE>
2929
bool Environment_Impl<StoragePolicy>::assign( const std::string& name, const WRAPPABLE& x) const {
30-
return assign( name, wrap( x ) ) ;
30+
return assign(name, Shield<SEXP>(wrap(x)));
3131
}
3232

3333
template <template <class> class StoragePolicy>

inst/include/Rcpp/api/meat/proxy.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,7 @@ template <typename CLASS>
184184
template <typename T>
185185
typename FieldProxyPolicy<CLASS>::FieldProxy&
186186
FieldProxyPolicy<CLASS>::FieldProxy::operator=(const T& rhs) {
187-
SEXP tmp = PROTECT(wrap(rhs));
188-
set(tmp);
189-
UNPROTECT(1);
187+
set(Shield<SEXP>(wrap(rhs)));
190188
return *this;
191189
}
192190

inst/include/Rcpp/vector/proxy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ namespace internal{
151151

152152
template <typename T>
153153
generic_name_proxy& operator=( const T& rhs ){
154-
set( ::Rcpp::wrap(rhs) ) ;
154+
set(Shield<SEXP>(wrap(rhs)));
155155
return *this ;
156156
}
157157

@@ -249,7 +249,7 @@ namespace traits {
249249
template<> struct r_vector_iterator<VECSXP> : proxy_based_iterator<VECSXP>{} ;
250250
template<> struct r_vector_iterator<EXPRSXP> : proxy_based_iterator<EXPRSXP>{} ;
251251
template<> struct r_vector_iterator<STRSXP> : proxy_based_iterator<STRSXP>{} ;
252-
252+
253253
template <int RTYPE> struct proxy_based_const_iterator{
254254
typedef ::Rcpp::internal::Proxy_Iterator< typename r_vector_const_proxy<RTYPE>::type > type ;
255255
} ;

0 commit comments

Comments
 (0)