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 @@ -876,7 +876,8 @@ inline r_vector<T>::r_vector(std::initializer_list<named_arg> il)
876876 }
877877
878878 unwind_protect ([&] {
879- SEXP names = Rf_allocVector (STRSXP, capacity_);
879+ SEXP names;
880+ PROTECT (names = Rf_allocVector (STRSXP, capacity_));
880881 Rf_setAttrib (data_, R_NamesSymbol, names);
881882
882883 auto it = il.begin ();
@@ -901,6 +902,8 @@ inline r_vector<T>::r_vector(std::initializer_list<named_arg> il)
901902 SEXP name = Rf_mkCharCE (it->name (), CE_UTF8);
902903 SET_STRING_ELT (names, i, name);
903904 }
905+
906+ UNPROTECT (1 );
904907 });
905908}
906909
You can’t perform that action at this time.
0 commit comments