From 32afbc0e1aa9fc10a3cf3fe60bc630ff39a4bfd5 Mon Sep 17 00:00:00 2001 From: Ivan K Date: Thu, 26 Dec 2024 18:01:34 +0300 Subject: [PATCH] copySharedColumns(): hash instead of TRUELENGTH --- src/utils.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/utils.c b/src/utils.c index 7f529e943..0c9d23fe6 100644 --- a/src/utils.c +++ b/src/utils.c @@ -261,36 +261,22 @@ void copySharedColumns(SEXP x) { const int ncol = length(x); if (!isNewList(x) || ncol==1) return; bool *shared = (bool *)R_alloc(ncol, sizeof(bool)); // on R heap in case alloc fails - int *savetl = (int *)R_alloc(ncol, sizeof(int)); // on R heap for convenience but could be a calloc + hashtab * marks = hash_create(ncol); const SEXP *xp = SEXPPTR_RO(x); - // first save the truelength, which may be negative on specials in dogroups, and set to zero; test 2157 - // the savetl() function elsewhere is for CHARSXP. Here, we are using truelength on atomic vectors. - for (int i=0; i