Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/assign.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ SEXP alloccol(SEXP dt, R_len_t n, Rboolean verbose)
if (isNull(klass)) error(_("dt passed to alloccol has no class attribute. Please report result of traceback() to data.table issue tracker."));
const R_len_t l = LENGTH(dt);
SEXP names = getAttrib(dt,R_NamesSymbol);
// names may be NULL when null.data.table() passes list() to alloccol for example.
// So, careful to use length() on names, not LENGTH().
if (length(names)!=l) internal_error(__func__, "length of names (%d) is not length of dt (%d)", length(names),l); // # nocov
if (LENGTH(names)!=l) internal_error(__func__, "length of names (%d) is not length of dt (%d)", LENGTH(names),l); // # nocov
if (!selfrefok(dt,verbose))
return shallow(dt,R_NilValue,(n>l) ? n : l); // e.g. test 848 and 851 in R > 3.0.2
// added (n>l) ? ... for #970, see test 1481.
Expand Down
3 changes: 1 addition & 2 deletions src/dogroups.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ static bool anySpecialStatic(SEXP x, hashtab * specials) {
// we restore the true truelength for when R starts to use vector truelength.
SEXP list_el;
const int n = length(x);
// use length() not LENGTH() because isNewList() is true for NULL
if (n==0)
return false;
if (isVectorAtomic(x))
Expand Down Expand Up @@ -362,7 +361,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
if (njval==0) njval = LENGTH(jval); // for first group, then the rest (when non 0) must conform to the first >0 group
if (njval!=LENGTH(jval)) error(_("j doesn't evaluate to the same number of columns for each group")); // this would be a problem even if we unlisted afterwards. This way the user finds out earlier though so he can fix and rerun sooner.
for (int j=0; j<njval; ++j) {
int k = length(VECTOR_ELT(jval,j)); // might be NULL, so length not LENGTH
int k = length(VECTOR_ELT(jval,j));
maxn = k>maxn ? k : maxn;
}
if (ansloc + maxn > estn) {
Expand Down
Loading