Skip to content

Commit aa49f26

Browse files
committed
RC13; set integers faster
1 parent 6163836 commit aa49f26

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/aio.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ static void haio_finalizer(SEXP xptr) {
137137

138138
static SEXP mk_error_saio(const int xc, SEXP env) {
139139

140-
SET_INTEGER_ELT(nano_error, 0, xc);
140+
INTEGER(nano_error)[0] = xc;
141141
Rf_defineVar(nano_ResultSymbol, nano_error, ENCLOS(env));
142142
return nano_error;
143143

144144
}
145145

146146
static SEXP mk_error_raio(const int xc, SEXP env) {
147147

148-
SET_INTEGER_ELT(nano_error, 0, xc);
148+
INTEGER(nano_error)[0] = xc;
149149
Rf_defineVar(nano_RawSymbol, nano_error, ENCLOS(env));
150150
Rf_defineVar(nano_DataSymbol, nano_error, ENCLOS(env));
151151
return nano_error;
@@ -154,7 +154,7 @@ static SEXP mk_error_raio(const int xc, SEXP env) {
154154

155155
static SEXP mk_error_haio(const int xc, SEXP env) {
156156

157-
SET_INTEGER_ELT(nano_error, 0, xc);
157+
INTEGER(nano_error)[0] = xc;
158158
Rf_defineVar(nano_StatusSymbol, nano_error, ENCLOS(env));
159159
Rf_defineVar(nano_IdSymbol, nano_error, ENCLOS(env));
160160
Rf_defineVar(nano_RawSymbol, nano_error, ENCLOS(env));
@@ -166,7 +166,7 @@ static SEXP mk_error_haio(const int xc, SEXP env) {
166166
static SEXP mk_error_data(const int xc) {
167167

168168
const char *names[] = {"data", ""};
169-
SET_INTEGER_ELT(nano_error, 0, xc);
169+
INTEGER(nano_error)[0] = xc;
170170
SEXP out = Rf_mkNamed(VECSXP, names);
171171
SET_VECTOR_ELT(out, 0, nano_error);
172172
return out;
@@ -176,7 +176,7 @@ static SEXP mk_error_data(const int xc) {
176176
static SEXP mk_error_result(const int xc) {
177177

178178
const char *names[] = {"result", ""};
179-
SET_INTEGER_ELT(nano_error, 0, xc);
179+
INTEGER(nano_error)[0] = xc;
180180
SEXP out = Rf_mkNamed(VECSXP, names);
181181
SET_VECTOR_ELT(out, 0, nano_error);
182182
return out;

src/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323

2424
SEXP mk_error(const int xc) {
2525

26-
SET_INTEGER_ELT(nano_error, 0, xc);
26+
INTEGER(nano_error)[0] = xc;
2727
return nano_error;
2828

2929
}
3030

3131
SEXP mk_error_recv(const int xc) {
3232

3333
const char *names[] = {"raw", "data", ""};
34-
SET_INTEGER_ELT(nano_error, 0, xc);
34+
INTEGER(nano_error)[0] = xc;
3535
SEXP out = Rf_mkNamed(VECSXP, names);
3636
SET_VECTOR_ELT(out, 0, nano_error);
3737
SET_VECTOR_ELT(out, 1, nano_error);
@@ -42,7 +42,7 @@ SEXP mk_error_recv(const int xc) {
4242
SEXP mk_error_ncurl(const int xc) {
4343

4444
const char *names[] = {"status", "headers", "raw", "data", ""};
45-
SET_INTEGER_ELT(nano_error, 0, xc);
45+
INTEGER(nano_error)[0] = xc;
4646
SEXP out = Rf_mkNamed(VECSXP, names);
4747
SET_VECTOR_ELT(out, 0, nano_error);
4848
SET_VECTOR_ELT(out, 1, nano_error);

0 commit comments

Comments
 (0)