Skip to content

Commit 76c0bbf

Browse files
committed
and more code cleanups
1 parent ab51ffb commit 76c0bbf

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/core.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ SEXP rawOneString(unsigned char *bytes, R_xlen_t nbytes, R_xlen_t *np) {
100100
SEXP nano_decode(unsigned char *buf, const size_t sz, const int mod, const int kpr) {
101101

102102
int tryErr = 0;
103-
SEXP raw, data;
103+
SEXP raw, data, expr, onechar;
104+
R_xlen_t i, m, nbytes = sz, np = 0;
104105

105106
switch (mod) {
106107
case 1:
107108
PROTECT(raw = Rf_allocVector(RAWSXP, sz));
108109
memcpy(RAW(raw), buf, sz);
109-
SEXP expr;
110110
PROTECT(expr = Rf_lang2(nano_UnserSymbol, raw));
111111
data = R_tryEval(expr, R_BaseEnv, &tryErr);
112112
UNPROTECT(1);
@@ -117,9 +117,8 @@ SEXP nano_decode(unsigned char *buf, const size_t sz, const int mod, const int k
117117
break;
118118
case 2:
119119
PROTECT(data = Rf_allocVector(STRSXP, sz));
120-
R_xlen_t i, m, nbytes = sz, np = 0;
121120
for (i = 0, m = 0; i < sz; i++) {
122-
SEXP onechar = rawOneString(buf, nbytes, &np);
121+
onechar = rawOneString(buf, nbytes, &np);
123122
if (onechar == R_NilValue) break;
124123
SET_STRING_ELT(data, i, onechar);
125124
if (Rf_xlength(onechar) > 0) m++;

0 commit comments

Comments
 (0)