@@ -53,13 +53,13 @@ namespace Rcpp {
53
53
54
54
/* * default constructor */
55
55
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);
57
57
RCPP_STRING_DEBUG (" String()" );
58
58
}
59
59
60
60
/* * copy constructor */
61
61
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);
63
63
RCPP_STRING_DEBUG (" String(const String&)" );
64
64
}
65
65
@@ -82,30 +82,30 @@ namespace Rcpp {
82
82
valid = true ;
83
83
buffer_ready = false ;
84
84
enc = Rf_getCharCE (data);
85
- token = Rcpp_PreserveObject (data);
85
+ token = Rcpp_PreciousPreserve (data);
86
86
RCPP_STRING_DEBUG (" String(SEXP)" );
87
87
}
88
88
89
89
/* * from string proxy */
90
90
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);
92
92
RCPP_STRING_DEBUG (" String(const StringProxy&)" );
93
93
}
94
94
95
95
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);
97
97
set_encoding (enc);
98
98
RCPP_STRING_DEBUG (" String(const StringProxy&, cetype_t)" );
99
99
}
100
100
101
101
/* * from string proxy */
102
102
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);
104
104
RCPP_STRING_DEBUG (" String(const const_StringProxy&)" );
105
105
}
106
106
107
107
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);
109
109
set_encoding (enc);
110
110
RCPP_STRING_DEBUG (" String(const const_StringProxy&, cetype_t)" );
111
111
}
@@ -118,7 +118,7 @@ namespace Rcpp {
118
118
}
119
119
120
120
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);
122
122
RCPP_STRING_DEBUG (" String(const std::wstring&, cetype_t)" );
123
123
}
124
124
@@ -130,79 +130,79 @@ namespace Rcpp {
130
130
}
131
131
132
132
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);
134
134
RCPP_STRING_DEBUG (" String(const wchar_t* s, cetype_t)" );
135
135
}
136
136
137
137
/* * constructors from R primitives */
138
138
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);
140
140
}
141
141
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);
143
143
}
144
144
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);
146
146
}
147
147
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);
149
149
}
150
150
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);
152
152
}
153
153
154
154
~String () {
155
- Rcpp_ReleaseObject (token);
155
+ Rcpp_PreciousRelease (token);
156
156
data = R_NilValue;
157
157
token = R_NilValue;
158
158
}
159
159
160
160
161
161
inline String& operator =(int x) {
162
162
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);
165
165
valid = true ;
166
166
buffer_ready = false ;
167
167
return *this ;
168
168
}
169
169
inline String& operator =(double x) {
170
170
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);
173
173
valid = true ;
174
174
buffer_ready = false ;
175
175
return *this ;
176
176
}
177
177
inline String& operator =(Rbyte x) {
178
178
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);
181
181
valid = true ;
182
182
buffer_ready = false ;
183
183
return *this ;
184
184
}
185
185
inline String& operator =(bool x) {
186
186
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);
189
189
valid = true ;
190
190
buffer_ready = false ;
191
191
return *this ;
192
192
}
193
193
inline String& operator =(Rcomplex x) {
194
194
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);
197
197
valid = true ;
198
198
buffer_ready = false ;
199
199
return *this ;
200
200
}
201
201
inline String& operator =(SEXP x) {
202
202
if (data != x) {
203
203
data = x;
204
- Rcpp_ReleaseObject (token);
205
- token = Rcpp_PreserveObject (data);
204
+ Rcpp_PreciousRelease (token);
205
+ token = Rcpp_PreciousPreserve (data);
206
206
}
207
207
valid = true ;
208
208
buffer_ready = false ;
@@ -212,8 +212,8 @@ namespace Rcpp {
212
212
SEXP x = proxy.get ();
213
213
if (data != x) {
214
214
data = x;
215
- Rcpp_ReleaseObject (token);
216
- token = Rcpp_PreserveObject (x);
215
+ Rcpp_PreciousRelease (token);
216
+ token = Rcpp_PreciousPreserve (x);
217
217
}
218
218
valid = true ;
219
219
buffer_ready = false ;
@@ -223,8 +223,8 @@ namespace Rcpp {
223
223
SEXP x = other.get_sexp ();
224
224
if (data != x) {
225
225
data = x;
226
- Rcpp_ReleaseObject (token);
227
- token = Rcpp_PreserveObject (x);
226
+ Rcpp_PreciousRelease (token);
227
+ token = Rcpp_PreciousPreserve (x);
228
228
}
229
229
valid = true ;
230
230
buffer_ready = false ;
@@ -247,8 +247,8 @@ namespace Rcpp {
247
247
template <typename T>
248
248
inline String& assign_wide_string (const T& s) {
249
249
data = internal::make_charsexp (s);
250
- Rcpp_ReleaseObject (token);
251
- token = Rcpp_PreserveObject (data);
250
+ Rcpp_PreciousRelease (token);
251
+ token = Rcpp_PreciousPreserve (data);
252
252
valid = true ;
253
253
buffer_ready = false ;
254
254
return *this ;
@@ -281,8 +281,8 @@ namespace Rcpp {
281
281
std::wstring tmp (buf, buf + strlen (buf));
282
282
tmp += s;
283
283
data = internal::make_charsexp (tmp);
284
- Rcpp_ReleaseObject (token);
285
- token = Rcpp_PreserveObject (data);
284
+ Rcpp_PreciousRelease (token);
285
+ token = Rcpp_PreciousPreserve (data);
286
286
valid = true ;
287
287
buffer_ready = false ;
288
288
return *this ;
@@ -298,8 +298,8 @@ namespace Rcpp {
298
298
if (is_na ()) return *this ;
299
299
if (other.is_na ()) {
300
300
data = NA_STRING;
301
- Rcpp_ReleaseObject (token);
302
- token = Rcpp_PreserveObject (data);
301
+ Rcpp_PreciousRelease (token);
302
+ token = Rcpp_PreciousPreserve (data);
303
303
valid = true ;
304
304
buffer_ready = false ;
305
305
return *this ;
@@ -313,8 +313,8 @@ namespace Rcpp {
313
313
SEXP proxy_sexp = proxy;
314
314
if (proxy_sexp == NA_STRING) {
315
315
data = NA_STRING;
316
- Rcpp_ReleaseObject (token);
317
- token = Rcpp_PreserveObject (data);
316
+ Rcpp_PreciousRelease (token);
317
+ token = Rcpp_PreciousPreserve (data);
318
318
valid = true ;
319
319
buffer_ready = false ;
320
320
return *this ;
@@ -328,8 +328,8 @@ namespace Rcpp {
328
328
SEXP proxy_sexp = proxy;
329
329
if (proxy_sexp == NA_STRING) {
330
330
data = NA_STRING;
331
- Rcpp_ReleaseObject (token);
332
- token = Rcpp_PreserveObject (data);
331
+ Rcpp_PreciousRelease (token);
332
+ token = Rcpp_PreciousPreserve (data);
333
333
valid = true ;
334
334
buffer_ready = false ;
335
335
return *this ;
@@ -342,8 +342,8 @@ namespace Rcpp {
342
342
if (is_na ()) return *this ;
343
343
if (x == NA_STRING) {
344
344
data = NA_STRING;
345
- Rcpp_ReleaseObject (token);
346
- token = Rcpp_PreserveObject (data);
345
+ Rcpp_PreciousRelease (token);
346
+ token = Rcpp_PreciousPreserve (data);
347
347
valid = true ;
348
348
buffer_ready = false ;
349
349
return *this ;
@@ -479,8 +479,8 @@ namespace Rcpp {
479
479
480
480
inline void set_na () {
481
481
data = NA_STRING;
482
- Rcpp_ReleaseObject (token);
483
- token = Rcpp_PreserveObject (data);
482
+ Rcpp_PreciousRelease (token);
483
+ token = Rcpp_PreciousPreserve (data);
484
484
valid = true ;
485
485
buffer_ready = false ;
486
486
}
@@ -533,11 +533,11 @@ namespace Rcpp {
533
533
// TODO: may longjmp on failure to translate?
534
534
const char * translated = Rf_translateCharUTF8 (data);
535
535
data = Rf_mkCharCE (translated, encoding);
536
- Rcpp_ReleaseObject (token);
537
- token = Rcpp_PreserveObject (data);
536
+ Rcpp_PreciousRelease (token);
537
+ token = Rcpp_PreciousPreserve (data);
538
538
} else {
539
539
data = get_sexp_impl ();
540
- token = Rcpp_PreserveObject (data);
540
+ token = Rcpp_PreciousPreserve (data);
541
541
valid = true ;
542
542
}
543
543
}
@@ -610,7 +610,7 @@ namespace Rcpp {
610
610
RCPP_STRING_DEBUG (" setData" );
611
611
if (!valid) {
612
612
data = get_sexp_impl ();
613
- token = Rcpp_PreserveObject (data);
613
+ token = Rcpp_PreciousPreserve (data);
614
614
valid = true ;
615
615
}
616
616
}
0 commit comments