diff --git a/src/assign.c b/src/assign.c index 57f0e6eb9b..76708486e9 100644 --- a/src/assign.c +++ b/src/assign.c @@ -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. diff --git a/src/dogroups.c b/src/dogroups.c index 5a677c9cd2..5e88a190e3 100644 --- a/src/dogroups.c +++ b/src/dogroups.c @@ -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)) @@ -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; jmaxn ? k : maxn; } if (ansloc + maxn > estn) {