Skip to content

Commit c4debb8

Browse files
using Rf_isNull instead of == R_NilValue
1 parent 40c9a00 commit c4debb8

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ namespace Rcpp{
224224
iterator it(begin()) ;
225225
iterator this_end(end()) ;
226226
SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
227-
if( names == R_NilValue ){
227+
if( Rf_isNull(names) ){
228228
int i=0;
229229
for( ; it < position; ++it, ++target_it, i++){
230230
*target_it = *it;
@@ -269,7 +269,7 @@ namespace Rcpp{
269269

270270
SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
271271
iterator result ;
272-
if( names == R_NilValue ){
272+
if( Rf_isNull(names) ){
273273
int i=0;
274274
for( ; it < first; ++it, ++target_it, i++ ){
275275
*target_it = *it ;
@@ -306,7 +306,7 @@ namespace Rcpp{
306306
iterator target_it( target.begin() ) ;
307307
iterator it(begin()) ;
308308
iterator this_end(end());
309-
if( names == R_NilValue ){
309+
if( Rf_isNull(names) ){
310310
for( ; it < this_end; ++it, ++target_it ){
311311
*target_it = *it ;
312312
}
@@ -334,7 +334,7 @@ namespace Rcpp{
334334
iterator target_it( target.begin() ) ;
335335
iterator it(begin()) ;
336336
iterator this_end(end());
337-
if( names == R_NilValue ){
337+
if( Rf_isNull(names) ){
338338
for( ; it < this_end; ++it, ++target_it ){
339339
*target_it = *it ;
340340
}
@@ -362,7 +362,7 @@ namespace Rcpp{
362362
SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
363363
Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n+1 ) ) ;
364364
int i=0;
365-
if( names == R_NilValue ){
365+
if( Rf_isNull(names) ){
366366
SEXP dummy = PROTECT( Rf_mkChar("") );
367367
for( ; it < this_end; ++it, ++target_it,i++ ){
368368
*target_it = *it ;
@@ -392,7 +392,7 @@ namespace Rcpp{
392392
SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
393393
Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n+1 ) ) ;
394394
int i=0;
395-
if( names == R_NilValue ){
395+
if( Rf_isNull(names) ){
396396
for( ; it < this_end; ++it, ++target_it,i++ ){
397397
*target_it = *it ;
398398
SET_STRING_ELT( newnames, i , R_BlankString );
@@ -420,7 +420,7 @@ namespace Rcpp{
420420
*target_it = object ;
421421
++target_it ;
422422
SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
423-
if( names == R_NilValue ){
423+
if( Rf_isNull(names) ){
424424
for( ; it<this_end; ++it, ++target_it){
425425
*target_it = *it ;
426426
}
@@ -448,7 +448,7 @@ namespace Rcpp{
448448
*target_it = object_sexp ;
449449
++target_it ;
450450
SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
451-
if( names == R_NilValue ){
451+
if( Rf_isNull(names) ){
452452
for( ; it<this_end; ++it, ++target_it){
453453
*target_it = *it ;
454454
}
@@ -479,7 +479,7 @@ namespace Rcpp{
479479
*target_it = object;
480480
++target_it ;
481481

482-
if( names == R_NilValue ){
482+
if( Rf_isNull(names) ){
483483
for( ; it < this_end; ++it, ++target_it,i++ ){
484484
*target_it = *it ;
485485
SET_STRING_ELT( newnames, i , R_BlankString );
@@ -510,7 +510,7 @@ namespace Rcpp{
510510
*target_it = object_sexp;
511511
++target_it ;
512512

513-
if( names == R_NilValue ){
513+
if( Rf_isNull(names) ){
514514
for( ; it < this_end; ++it, ++target_it,i++ ){
515515
*target_it = *it ;
516516
SET_STRING_ELT( newnames, i , R_BlankString );
@@ -534,7 +534,7 @@ namespace Rcpp{
534534
iterator this_end = end() ;
535535
SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
536536
iterator result ;
537-
if( names == R_NilValue ){
537+
if( Rf_isNull(names) ){
538538
for( ; it < position; ++it, ++target_it){
539539
*target_it = *it ;
540540
}
@@ -576,7 +576,7 @@ namespace Rcpp{
576576
iterator this_end = end() ;
577577
SEXP names = RCPP_GET_NAMES(Storage::get__()) ;
578578
iterator result ;
579-
if( names == R_NilValue ){
579+
if( Rf_isNull(names) ){
580580
for( ; it < position; ++it, ++target_it){
581581
*target_it = *it ;
582582
}

inst/include/Rcpp/vector/Vector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class Vector :
189189

190190
R_len_t offset(const std::string& name) const {
191191
SEXP names = RCPP_GET_NAMES( Storage::get__() ) ;
192-
if( names == R_NilValue ) throw index_out_of_bounds();
192+
if( Rf_isNull(names) ) throw index_out_of_bounds();
193193
R_len_t n=size() ;
194194
for( R_len_t i=0; i<n; ++i){
195195
if( ! name.compare( CHAR(STRING_ELT(names, i)) ) ){

inst/include/RcppCommon.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ namespace Rcpp{
101101
}
102102

103103
inline SEXP Rcpp_ReplaceObject(SEXP x, SEXP y){
104-
if( x == R_NilValue ){
104+
if( Rf_isNull(x) ){
105105
Rcpp_PreserveObject( y ) ;
106-
} else if( y == R_NilValue ){
106+
} else if( Rf_isNull(y) ){
107107
Rcpp_ReleaseObject( x ) ;
108108
} else {
109109
// if we are setting to the same SEXP as we already have, do nothing

src/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
SEXP __CARGS__[MAX_ARGS] ; \
4141
int nargs = 0 ; \
4242
for(; nargs<MAX_ARGS; nargs++){ \
43-
if( __P__ == R_NilValue ) break ; \
43+
if( Rf_isNull(__P__) ) break ; \
4444
__CARGS__[nargs] = CAR(__P__) ; \
4545
__P__ = CDR(__P__) ; \
4646
}

0 commit comments

Comments
 (0)