Skip to content

Commit

Permalink
Use LOGICAL_RO() instead of LOGICAL() in copyVector() to avoid ALTREP…
Browse files Browse the repository at this point in the history
… materialization
  • Loading branch information
krlmlr committed Jul 12, 2024
1 parent 09f3acb commit bd4650e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/duplicate.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,23 +382,23 @@ void copyVector(SEXP s, SEXP t)
xcopyStringWithRecycle(s, t, 0, ns, nt);
break;
case LGLSXP:
xcopyLogicalWithRecycle(LOGICAL(s), LOGICAL(t), 0, ns, nt);
xcopyLogicalWithRecycle(LOGICAL(s), LOGICAL_RO(t), 0, ns, nt);
break;
case INTSXP:
xcopyIntegerWithRecycle(INTEGER(s), INTEGER(t), 0, ns, nt);
xcopyIntegerWithRecycle(INTEGER(s), INTEGER_RO(t), 0, ns, nt);
break;
case REALSXP:
xcopyRealWithRecycle(REAL(s), REAL(t), 0, ns, nt);
xcopyRealWithRecycle(REAL(s), REAL_RO(t), 0, ns, nt);
break;
case CPLXSXP:
xcopyComplexWithRecycle(COMPLEX(s), COMPLEX(t), 0, ns, nt);
xcopyComplexWithRecycle(COMPLEX(s), COMPLEX_RO(t), 0, ns, nt);
break;
case EXPRSXP:
case VECSXP:
xcopyVectorWithRecycle(s, t, 0, ns, nt);
break;
case RAWSXP:
xcopyRawWithRecycle(RAW(s), RAW(t), 0, ns, nt);
xcopyRawWithRecycle(RAW(s), RAW_RO(t), 0, ns, nt);
break;
default:
UNIMPLEMENTED_TYPE("copyVector", s);
Expand Down

0 comments on commit bd4650e

Please sign in to comment.