@@ -53,13 +53,13 @@ namespace Rcpp {
5353
5454 /* * default constructor */
5555 String (): data(Rf_mkCharCE(" " , CE_UTF8)), token(R_NilValue), buffer(), valid(true ), buffer_ready(true ), enc(CE_UTF8) {
56- token = Rcpp_PreserveObject (data);
56+ token = Rcpp_PreciousPreserve (data);
5757 RCPP_STRING_DEBUG (" String()" );
5858 }
5959
6060 /* * copy constructor */
6161 String (const String& other) : data(other.get_sexp()), token(R_NilValue), valid(true ), buffer_ready(false ), enc(Rf_getCharCE(other.get_sexp())) {
62- token = Rcpp_PreserveObject (data);
62+ token = Rcpp_PreciousPreserve (data);
6363 RCPP_STRING_DEBUG (" String(const String&)" );
6464 }
6565
@@ -82,30 +82,30 @@ namespace Rcpp {
8282 valid = true ;
8383 buffer_ready = false ;
8484 enc = Rf_getCharCE (data);
85- token = Rcpp_PreserveObject (data);
85+ token = Rcpp_PreciousPreserve (data);
8686 RCPP_STRING_DEBUG (" String(SEXP)" );
8787 }
8888
8989 /* * from string proxy */
9090 String (const StringProxy& proxy): data(proxy.get()), token(R_NilValue), valid(true ), buffer_ready(false ), enc(Rf_getCharCE(proxy.get())) {
91- token = Rcpp_PreserveObject (data);
91+ token = Rcpp_PreciousPreserve (data);
9292 RCPP_STRING_DEBUG (" String(const StringProxy&)" );
9393 }
9494
9595 String (const StringProxy& proxy, cetype_t enc): data(proxy.get()), token(R_NilValue), valid(true ), buffer_ready(false ) {
96- token = Rcpp_PreserveObject (data);
96+ token = Rcpp_PreciousPreserve (data);
9797 set_encoding (enc);
9898 RCPP_STRING_DEBUG (" String(const StringProxy&, cetype_t)" );
9999 }
100100
101101 /* * from string proxy */
102102 String (const const_StringProxy& proxy): data(proxy.get()), token(R_NilValue), valid(true ), buffer_ready(false ), enc(Rf_getCharCE(proxy.get())) {
103- token = Rcpp_PreserveObject (data);
103+ token = Rcpp_PreciousPreserve (data);
104104 RCPP_STRING_DEBUG (" String(const const_StringProxy&)" );
105105 }
106106
107107 String (const const_StringProxy& proxy, cetype_t enc): data(proxy.get()), token(R_NilValue), valid(true ), buffer_ready(false ) {
108- token = Rcpp_PreserveObject (data);
108+ token = Rcpp_PreciousPreserve (data);
109109 set_encoding (enc);
110110 RCPP_STRING_DEBUG (" String(const const_StringProxy&, cetype_t)" );
111111 }
@@ -118,7 +118,7 @@ namespace Rcpp {
118118 }
119119
120120 String (const std::wstring& s, cetype_t enc = CE_UTF8) : data(internal::make_charsexp(s)), token(R_NilValue), valid(true ), buffer_ready(false ), enc(enc) {
121- token = Rcpp_PreserveObject (data);
121+ token = Rcpp_PreciousPreserve (data);
122122 RCPP_STRING_DEBUG (" String(const std::wstring&, cetype_t)" );
123123 }
124124
@@ -130,79 +130,79 @@ namespace Rcpp {
130130 }
131131
132132 String (const wchar_t * s, cetype_t enc = CE_UTF8) : data(internal::make_charsexp(s)), token(R_NilValue), valid(true ), buffer_ready(false ), enc(enc) {
133- token = Rcpp_PreserveObject (data);
133+ token = Rcpp_PreciousPreserve (data);
134134 RCPP_STRING_DEBUG (" String(const wchar_t* s, cetype_t)" );
135135 }
136136
137137 /* * constructors from R primitives */
138138 String (int x) : data(internal::r_coerce<INTSXP,STRSXP>(x)), token(R_NilValue), valid(true ), buffer_ready(false ), enc(CE_UTF8) {
139- token = Rcpp_PreserveObject (data);
139+ token = Rcpp_PreciousPreserve (data);
140140 }
141141 String (double x) : data(internal::r_coerce<REALSXP,STRSXP>(x)), token(R_NilValue), valid(true ), buffer_ready(false ), enc(CE_UTF8) {
142- token = Rcpp_PreserveObject (data);
142+ token = Rcpp_PreciousPreserve (data);
143143 }
144144 String (bool x) : data(internal::r_coerce<LGLSXP,STRSXP>(x)), token(R_NilValue), valid(true ) , buffer_ready(false ), enc(CE_UTF8) {
145- token = Rcpp_PreserveObject (data);
145+ token = Rcpp_PreciousPreserve (data);
146146 }
147147 String (Rcomplex x) : data(internal::r_coerce<CPLXSXP,STRSXP>(x)), token(R_NilValue), valid(true ), buffer_ready(false ), enc(CE_UTF8) {
148- token = Rcpp_PreserveObject (data);
148+ token = Rcpp_PreciousPreserve (data);
149149 }
150150 String (Rbyte x) : data(internal::r_coerce<RAWSXP,STRSXP>(x)), token(R_NilValue), valid(true ), buffer_ready(false ), enc(CE_UTF8) {
151- token = Rcpp_PreserveObject (data);
151+ token = Rcpp_PreciousPreserve (data);
152152 }
153153
154154 ~String () {
155- Rcpp_ReleaseObject (token);
155+ Rcpp_PreciousRelease (token);
156156 data = R_NilValue;
157157 token = R_NilValue;
158158 }
159159
160160
161161 inline String& operator =(int x) {
162162 data = internal::r_coerce<INTSXP, STRSXP>(x);
163- Rcpp_ReleaseObject (token);
164- token = Rcpp_PreserveObject (data);
163+ Rcpp_PreciousRelease (token);
164+ token = Rcpp_PreciousPreserve (data);
165165 valid = true ;
166166 buffer_ready = false ;
167167 return *this ;
168168 }
169169 inline String& operator =(double x) {
170170 data = internal::r_coerce<REALSXP, STRSXP>(x);
171- Rcpp_ReleaseObject (token);
172- token = Rcpp_PreserveObject (data);
171+ Rcpp_PreciousRelease (token);
172+ token = Rcpp_PreciousPreserve (data);
173173 valid = true ;
174174 buffer_ready = false ;
175175 return *this ;
176176 }
177177 inline String& operator =(Rbyte x) {
178178 data = internal::r_coerce<RAWSXP, STRSXP>(x);
179- Rcpp_ReleaseObject (token);
180- token = Rcpp_PreserveObject (data);
179+ Rcpp_PreciousRelease (token);
180+ token = Rcpp_PreciousPreserve (data);
181181 valid = true ;
182182 buffer_ready = false ;
183183 return *this ;
184184 }
185185 inline String& operator =(bool x) {
186186 data = internal::r_coerce<LGLSXP, STRSXP>(x);
187- Rcpp_ReleaseObject (token);
188- token = Rcpp_PreserveObject (data);
187+ Rcpp_PreciousRelease (token);
188+ token = Rcpp_PreciousPreserve (data);
189189 valid = true ;
190190 buffer_ready = false ;
191191 return *this ;
192192 }
193193 inline String& operator =(Rcomplex x) {
194194 data = internal::r_coerce<CPLXSXP, STRSXP>(x);
195- Rcpp_ReleaseObject (token);
196- token = Rcpp_PreserveObject (data);
195+ Rcpp_PreciousRelease (token);
196+ token = Rcpp_PreciousPreserve (data);
197197 valid = true ;
198198 buffer_ready = false ;
199199 return *this ;
200200 }
201201 inline String& operator =(SEXP x) {
202202 if (data != x) {
203203 data = x;
204- Rcpp_ReleaseObject (token);
205- token = Rcpp_PreserveObject (data);
204+ Rcpp_PreciousRelease (token);
205+ token = Rcpp_PreciousPreserve (data);
206206 }
207207 valid = true ;
208208 buffer_ready = false ;
@@ -212,8 +212,8 @@ namespace Rcpp {
212212 SEXP x = proxy.get ();
213213 if (data != x) {
214214 data = x;
215- Rcpp_ReleaseObject (token);
216- token = Rcpp_PreserveObject (x);
215+ Rcpp_PreciousRelease (token);
216+ token = Rcpp_PreciousPreserve (x);
217217 }
218218 valid = true ;
219219 buffer_ready = false ;
@@ -223,8 +223,8 @@ namespace Rcpp {
223223 SEXP x = other.get_sexp ();
224224 if (data != x) {
225225 data = x;
226- Rcpp_ReleaseObject (token);
227- token = Rcpp_PreserveObject (x);
226+ Rcpp_PreciousRelease (token);
227+ token = Rcpp_PreciousPreserve (x);
228228 }
229229 valid = true ;
230230 buffer_ready = false ;
@@ -247,8 +247,8 @@ namespace Rcpp {
247247 template <typename T>
248248 inline String& assign_wide_string (const T& s) {
249249 data = internal::make_charsexp (s);
250- Rcpp_ReleaseObject (token);
251- token = Rcpp_PreserveObject (data);
250+ Rcpp_PreciousRelease (token);
251+ token = Rcpp_PreciousPreserve (data);
252252 valid = true ;
253253 buffer_ready = false ;
254254 return *this ;
@@ -281,8 +281,8 @@ namespace Rcpp {
281281 std::wstring tmp (buf, buf + strlen (buf));
282282 tmp += s;
283283 data = internal::make_charsexp (tmp);
284- Rcpp_ReleaseObject (token);
285- token = Rcpp_PreserveObject (data);
284+ Rcpp_PreciousRelease (token);
285+ token = Rcpp_PreciousPreserve (data);
286286 valid = true ;
287287 buffer_ready = false ;
288288 return *this ;
@@ -298,8 +298,8 @@ namespace Rcpp {
298298 if (is_na ()) return *this ;
299299 if (other.is_na ()) {
300300 data = NA_STRING;
301- Rcpp_ReleaseObject (token);
302- token = Rcpp_PreserveObject (data);
301+ Rcpp_PreciousRelease (token);
302+ token = Rcpp_PreciousPreserve (data);
303303 valid = true ;
304304 buffer_ready = false ;
305305 return *this ;
@@ -313,8 +313,8 @@ namespace Rcpp {
313313 SEXP proxy_sexp = proxy;
314314 if (proxy_sexp == NA_STRING) {
315315 data = NA_STRING;
316- Rcpp_ReleaseObject (token);
317- token = Rcpp_PreserveObject (data);
316+ Rcpp_PreciousRelease (token);
317+ token = Rcpp_PreciousPreserve (data);
318318 valid = true ;
319319 buffer_ready = false ;
320320 return *this ;
@@ -328,8 +328,8 @@ namespace Rcpp {
328328 SEXP proxy_sexp = proxy;
329329 if (proxy_sexp == NA_STRING) {
330330 data = NA_STRING;
331- Rcpp_ReleaseObject (token);
332- token = Rcpp_PreserveObject (data);
331+ Rcpp_PreciousRelease (token);
332+ token = Rcpp_PreciousPreserve (data);
333333 valid = true ;
334334 buffer_ready = false ;
335335 return *this ;
@@ -342,8 +342,8 @@ namespace Rcpp {
342342 if (is_na ()) return *this ;
343343 if (x == NA_STRING) {
344344 data = NA_STRING;
345- Rcpp_ReleaseObject (token);
346- token = Rcpp_PreserveObject (data);
345+ Rcpp_PreciousRelease (token);
346+ token = Rcpp_PreciousPreserve (data);
347347 valid = true ;
348348 buffer_ready = false ;
349349 return *this ;
@@ -479,8 +479,8 @@ namespace Rcpp {
479479
480480 inline void set_na () {
481481 data = NA_STRING;
482- Rcpp_ReleaseObject (token);
483- token = Rcpp_PreserveObject (data);
482+ Rcpp_PreciousRelease (token);
483+ token = Rcpp_PreciousPreserve (data);
484484 valid = true ;
485485 buffer_ready = false ;
486486 }
@@ -533,11 +533,11 @@ namespace Rcpp {
533533 // TODO: may longjmp on failure to translate?
534534 const char * translated = Rf_translateCharUTF8 (data);
535535 data = Rf_mkCharCE (translated, encoding);
536- Rcpp_ReleaseObject (token);
537- token = Rcpp_PreserveObject (data);
536+ Rcpp_PreciousRelease (token);
537+ token = Rcpp_PreciousPreserve (data);
538538 } else {
539539 data = get_sexp_impl ();
540- token = Rcpp_PreserveObject (data);
540+ token = Rcpp_PreciousPreserve (data);
541541 valid = true ;
542542 }
543543 }
@@ -610,7 +610,7 @@ namespace Rcpp {
610610 RCPP_STRING_DEBUG (" setData" );
611611 if (!valid) {
612612 data = get_sexp_impl ();
613- token = Rcpp_PreserveObject (data);
613+ token = Rcpp_PreciousPreserve (data);
614614 valid = true ;
615615 }
616616 }
0 commit comments