Skip to content

Commit 0160b1c

Browse files
committed
improved constness
1 parent 9ca4c25 commit 0160b1c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/nqrecreateindices.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
// See other TODOs inside the function.
66
SEXP nqRecreateIndices(SEXP xo, SEXP len, SEXP indices, SEXP nArg, SEXP nomatch)
77
{
8-
R_len_t n = INTEGER(nArg)[0], xn = length(xo);
8+
const R_len_t n = INTEGER_RO(nArg)[0], xn = length(xo);
99
SEXP ans, newstarts, newlen;
1010
ans = PROTECT(allocVector(VECSXP, 2));
1111
SET_VECTOR_ELT(ans, 0, (newstarts = allocVector(INTSXP, n)));
1212
SET_VECTOR_ELT(ans, 1, (newlen = allocVector(INTSXP, n)));
1313

1414
int *inewlen = INTEGER(newlen);
15-
const int *iindices = INTEGER(indices);
16-
const int *ilen = INTEGER(len);
17-
const int *ixo = INTEGER(xo);
18-
const int inomatch = isNull(nomatch) ? 0 : INTEGER(nomatch)[0];
15+
const int *iindices = INTEGER_RO(indices);
16+
const int *ilen = INTEGER_RO(len);
17+
const int *ixo = INTEGER_RO(xo);
18+
const int inomatch = isNull(nomatch) ? 0 : INTEGER_RO(nomatch)[0];
1919
int *inewstarts = INTEGER(newstarts);
2020

2121
memset(inewlen, 0, n * sizeof(int));

0 commit comments

Comments
 (0)