File tree Expand file tree Collapse file tree 5 files changed +11
-6
lines changed
Expand file tree Collapse file tree 5 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 11#pragma once
22
3- #include < cstdlib> // for abs
4- #include < cstdlib>
3+ #include < cstdlib> // for abs
54#include < initializer_list> // for initializer_list
65#include < string> // for string, basic_string
76#include < utility> // for move
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ class external_pointer {
3838
3939 T* ptr = static_cast <T*>(R_ExternalPtrAddr (p));
4040
41- if (ptr == NULL ) {
41+ if (ptr == nullptr ) {
4242 return ;
4343 }
4444
Original file line number Diff line number Diff line change 11#pragma once
22
3- #include < string.h > // for strcmp
3+ #include < cstring > // for std:: strcmp (@pachadotdev use std qualifiers)
44
55#include < cstdio> // for snprintf
66#include < string> // for string, basic_string
Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ inline r_vector<SEXP>::r_vector(std::initializer_list<named_arg> il)
7979 : cpp11::r_vector<SEXP>(safe[Rf_allocVector](VECSXP, il.size())),
8080 capacity_ (il.size()) {
8181 unwind_protect ([&] {
82- SEXP names = Rf_allocVector (STRSXP, capacity_);
82+ SEXP names;
83+ PROTECT (names = Rf_allocVector (STRSXP, capacity_));
8384 Rf_setAttrib (data_, R_NamesSymbol, names);
8485
8586 auto it = il.begin ();
@@ -91,6 +92,8 @@ inline r_vector<SEXP>::r_vector(std::initializer_list<named_arg> il)
9192 SEXP name = Rf_mkCharCE (it->name (), CE_UTF8);
9293 SET_STRING_ELT (names, i, name);
9394 }
95+
96+ UNPROTECT (1 );
9497 });
9598}
9699
Original file line number Diff line number Diff line change @@ -874,7 +874,8 @@ inline r_vector<T>::r_vector(std::initializer_list<named_arg> il)
874874 }
875875
876876 unwind_protect ([&] {
877- SEXP names = Rf_allocVector (STRSXP, capacity_);
877+ SEXP names;
878+ PROTECT (names = Rf_allocVector (STRSXP, capacity_));
878879 Rf_setAttrib (data_, R_NamesSymbol, names);
879880
880881 auto it = il.begin ();
@@ -899,6 +900,8 @@ inline r_vector<T>::r_vector(std::initializer_list<named_arg> il)
899900 SEXP name = Rf_mkCharCE (it->name (), CE_UTF8);
900901 SET_STRING_ELT (names, i, name);
901902 }
903+
904+ UNPROTECT (1 );
902905 });
903906}
904907
You can’t perform that action at this time.
0 commit comments