Skip to content

Commit

Permalink
avoids DATAPTR
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Jun 23, 2024
1 parent 9290f8c commit b2880ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Imports:
mirai (>= 1.0.0),
nanonext (>= 1.0.0),
RcppSimdJson (>= 0.1.9),
secretbase (>= 0.3.0),
secretbase (>= 1.0.0),
shiny (>= 1.4.0),
xts,
zoo
Expand Down
6 changes: 4 additions & 2 deletions src/shikokuchuo.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <Rinternals.h>
#include <R_ext/Visibility.h>

#define ICHIMOKU_DATAPTR(x) (void *) DATAPTR_RO(x)

SEXP xts_IndexSymbol;
SEXP xts_IndexTclassSymbol;
SEXP xts_IndexTzoneSymbol;
Expand Down Expand Up @@ -179,7 +181,7 @@ SEXP _tbl(SEXP x, SEXP type) {
for (R_xlen_t j = 1; j <= xwid; j++) {
SEXP vec = Rf_allocVector(REALSXP, xlen);
SET_VECTOR_ELT(tbl, j, vec);
memcpy(DATAPTR(vec), src, vecsize);
memcpy(ICHIMOKU_DATAPTR(vec), src, vecsize);
src += xlen;
}

Expand Down Expand Up @@ -284,7 +286,7 @@ SEXP _df(SEXP x) {
for (R_xlen_t j = 1; j <= xwid; j++) {
SEXP vec = Rf_allocVector(REALSXP, xlen);
SET_VECTOR_ELT(df, j, vec);
memcpy(DATAPTR(vec), src, vecsize);
memcpy(ICHIMOKU_DATAPTR(vec), src, vecsize);
src += xlen;
}

Expand Down

0 comments on commit b2880ff

Please sign in to comment.