|
5 | 5 | // See other TODOs inside the function. |
6 | 6 | SEXP nqRecreateIndices(SEXP xo, SEXP len, SEXP indices, SEXP nArg, SEXP nomatch) |
7 | 7 | { |
8 | | - R_len_t n = INTEGER(nArg)[0], xn = length(xo); |
| 8 | + const R_len_t n = INTEGER_RO(nArg)[0], xn = length(xo); |
9 | 9 | SEXP ans, newstarts, newlen; |
10 | 10 | ans = PROTECT(allocVector(VECSXP, 2)); |
11 | 11 | SET_VECTOR_ELT(ans, 0, (newstarts = allocVector(INTSXP, n))); |
12 | 12 | SET_VECTOR_ELT(ans, 1, (newlen = allocVector(INTSXP, n))); |
13 | 13 |
|
14 | 14 | 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]; |
19 | 19 | int *inewstarts = INTEGER(newstarts); |
20 | 20 |
|
21 | 21 | memset(inewlen, 0, n * sizeof(int)); |
|
0 commit comments