Skip to content

Commit 053d905

Browse files
authored
remove the elem object (#7241)
1 parent 81e0722 commit 053d905

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/freadR.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,13 @@ bool userOverride(int8_t *type, lenOff *colNames, const char *anchor, const int
265265
colNamesSxp = R_NilValue;
266266
SET_VECTOR_ELT(RCHK, 1, colNamesSxp = allocVector(STRSXP, ncol));
267267
for (int i = 0; i < ncol; i++) {
268-
SEXP elem;
269268
if (colNames == NULL || colNames[i].len <= 0) {
270269
char buff[12];
271270
snprintf(buff, sizeof(buff), "V%d", i + 1); // # notranslate
272-
elem = mkChar(buff); // no PROTECT as passed immediately to SET_STRING_ELT
271+
SET_STRING_ELT(colNamesSxp, i, mkChar(buff)); // no PROTECT as passed immediately to SET_STRING_ELT
273272
} else {
274-
elem = mkCharLenCE(anchor + colNames[i].off, colNames[i].len, ienc); // no PROTECT as passed immediately to SET_STRING_ELT
273+
SET_STRING_ELT(colNamesSxp, i, mkCharLenCE(anchor + colNames[i].off, colNames[i].len, ienc)); // no PROTECT as passed immediately to SET_STRING_ELT
275274
}
276-
SET_STRING_ELT(colNamesSxp, i, elem);
277275
}
278276
// "use either select= or drop= but not both" was checked earlier in freadR
279277
applyDrop(dropSxp, type, ncol, /*dropSource=*/-1);

0 commit comments

Comments
 (0)