Skip to content

Commit 7967889

Browse files
committed
made todo labels consistent
1 parent 1b3998e commit 7967889

26 files changed

+120
-119
lines changed

src/assign.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ closest I got to getting it to pass all tests :
7878
setAttrib(x, SelfRefSymbol, p = R_MakeExternalPtr(
7979
R_NilValue, // for identical() to return TRUE. identical() doesn't look at tag and prot
8080
R_NilValue, //getAttrib(x, R_NamesSymbol), // to detect if names has been replaced and its tl lost, e.g. setattr(DT,"names",...)
81-
PROTECT( // needed when --enable-strict-barrier it seems, iiuc. TO DO: test under that flag and remove if not needed.
81+
PROTECT( // needed when --enable-strict-barrier it seems, iiuc. todo: test under that flag and remove if not needed.
8282
env // wrap x in env to avoid an infinite loop in object.size() if prot=x were here
8383
)
8484
));
@@ -151,10 +151,10 @@ static SEXP shallow(SEXP dt, SEXP cols, R_len_t n)
151151
// called from alloccol where n is checked carefully, or from shallow() at R level
152152
// where n is set to truelength (i.e. a shallow copy only with no size change)
153153
int protecti=0;
154-
SEXP newdt = PROTECT(allocVector(VECSXP, n)); protecti++; // to do, use growVector here?
154+
SEXP newdt = PROTECT(allocVector(VECSXP, n)); protecti++; // todo: use growVector here?
155155
SHALLOW_DUPLICATE_ATTRIB(newdt, dt);
156156

157-
// TO DO: keepattr() would be faster, but can't because shallow isn't merely a shallow copy. It
157+
// todo: keepattr() would be faster, but can't because shallow isn't merely a shallow copy. It
158158
// also increases truelength. Perhaps make that distinction, then, and split out, but marked
159159
// so that the next change knows to duplicate.
160160
// keepattr() also merely points to the entire attributes list and thus doesn't allow replacing
@@ -255,7 +255,7 @@ SEXP alloccol(SEXP dt, R_len_t n, Rboolean verbose)
255255
if (!selfrefok(dt,verbose))
256256
return shallow(dt,R_NilValue,(n>l) ? n : l); // e.g. test 848 and 851 in R > 3.0.2
257257
// added (n>l) ? ... for #970, see test 1481.
258-
// TO DO: test realloc names if selfrefnamesok (users can setattr(x,"name") themselves for example.
258+
// todo: test realloc names if selfrefnamesok (users can setattr(x,"name") themselves for example.
259259
// if (TRUELENGTH(getAttrib(dt,R_NamesSymbol))!=tl)
260260
// internal_error(__func__, "tl of dt passes checks, but tl of names (%d) != tl of dt (%d)", tl, TRUELENGTH(getAttrib(dt,R_NamesSymbol))); // # nocov
261261

@@ -377,7 +377,7 @@ SEXP assign(SEXP dt, SEXP rows, SEXP cols, SEXP newcolnames, SEXP values)
377377
if (rowsd[i]>=0) numToDo++;
378378
}
379379
if (verbose) Rprintf(_("Assigning to %d row subset of %d rows\n"), numToDo, nrow);
380-
// TODO: include in message if any rows are assigned several times (e.g. by=.EACHI with dups in i)
380+
// todo: include in message if any rows are assigned several times (e.g. by=.EACHI with dups in i)
381381
if (numToDo==0) {
382382
// isString(cols) is exclusive to calls from set()
383383
if (!length(newcolnames) && !isString(cols)) {
@@ -506,7 +506,7 @@ SEXP assign(SEXP dt, SEXP rows, SEXP cols, SEXP newcolnames, SEXP values)
506506
// modify DT by reference. Other than if new columns are being added and the allocVec() fails with
507507
// out-of-memory. In that case the user will receive hard halt and know to rerun.
508508
if (length(newcolnames)) {
509-
oldtncol = TRUELENGTH(dt); // TO DO: oldtncol can be just called tl now, as we won't realloc here any more.
509+
oldtncol = TRUELENGTH(dt); // todo: oldtncol can be just called tl now, as we won't realloc here any more.
510510

511511
if (oldtncol<oldncol) {
512512
if (oldtncol==0) error(_("This data.table has either been loaded from disk (e.g. using readRDS()/load()) or constructed manually (e.g. using structure()). Please run setDT() or setalloccol() on it first (to pre-allocate space for new columns) before assigning by reference to it.")); // #2996
@@ -1258,7 +1258,7 @@ SEXP allocNAVector(SEXPTYPE type, R_len_t n)
12581258

12591259
SEXP allocNAVectorLike(SEXP x, R_len_t n) {
12601260
// writeNA needs the attribute retained to write NA_INTEGER64, #3723
1261-
// TODO: remove allocNAVector above when usage in fastmean.c, fcast.c and fmelt.c can be adjusted; see comments in PR3724
1261+
// todo: remove allocNAVector above when usage in fastmean.c, fcast.c and fmelt.c can be adjusted; see comments in PR3724
12621262
SEXP v = PROTECT(allocVector(TYPEOF(x), n));
12631263
copyMostAttrib(x, v);
12641264
writeNA(v, 0, n, false);

src/between.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ SEXP between(SEXP x, SEXP lower, SEXP upper, SEXP incbounds, SEXP NAboundsArg, S
171171
const SEXP *xp = STRING_PTR_RO(x);
172172
#define LCMP (strcmp(CHAR(ENC2UTF8(l)),CHAR(ENC2UTF8(elem)))<=-open)
173173
#define UCMP (strcmp(CHAR(ENC2UTF8(elem)),CHAR(ENC2UTF8(u)))<=-open)
174-
// TODO if all ascii can be parallel, otherwise ENC2UTF8 could allocate
174+
// todo: if all ascii can be parallel, otherwise ENC2UTF8 could allocate
175175
if (check) for (int i=0; i<longestBound; ++i) {
176176
const SEXP l=lp[i & lowMask], u=up[i & uppMask];
177177
if (l!=NA_STRING && u!=NA_STRING && l!=u && strcmp(CHAR(ENC2UTF8(l)), CHAR(ENC2UTF8(u)))>0)

src/bmerge.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ SEXP bmerge(SEXP idt, SEXP xdt, SEXP icolsArg, SEXP xcolsArg, SEXP xoArg, SEXP r
152152
} else { // equi joins (or) non-equi join but no multiple matches
153153
retFirstArg = PROTECT(allocVector(INTSXP, anslen));
154154
retFirst = INTEGER(retFirstArg);
155-
retLengthArg = PROTECT(allocVector(INTSXP, anslen)); // TODO: no need to allocate length at all when
155+
retLengthArg = PROTECT(allocVector(INTSXP, anslen)); // todo: no need to allocate length at all when
156156
retLength = INTEGER(retLengthArg); // mult = "first" / "last"
157157
retIndexArg = PROTECT(allocVector(INTSXP, 0));
158158
retIndex = INTEGER(retIndexArg);
@@ -162,7 +162,7 @@ SEXP bmerge(SEXP idt, SEXP xdt, SEXP icolsArg, SEXP xcolsArg, SEXP xoArg, SEXP r
162162
// defaults need to populated here as bmerge_r may well not touch many locations, say if the last row of i is before the first row of x.
163163
retFirst[j] = nomatch; // default to no match for NA goto below
164164
}
165-
// retLength[j] = 0; // TO DO: do this to save the branch below and later branches at R level to set .N to 0
165+
// retLength[j] = 0; // todo: do this to save the branch below and later branches at R level to set .N to 0
166166
int retLengthVal = (int)(nomatch != 0);
167167
for (int j=0; j<anslen; j++)
168168
retLength[j] = retLengthVal;
@@ -271,12 +271,12 @@ void bmerge_r(int xlowIn, int xuppIn, int ilowIn, int iuppIn, int col, int thisg
271271
XVAL; \
272272
if (CMP1) { /* relies on NA_INTEGER==INT_MIN, tested in init.c */ \
273273
xlow=mid; \
274-
} else if (CMP2) { /* TO DO: switch(sign(xval-ival)) ? */ \
274+
} else if (CMP2) { /* todo: switch(sign(xval-ival)) ? */ \
275275
xupp=mid; \
276276
} else { \
277277
/* xval == ival including NA_INTEGER==NA_INTEGER \
278278
branch mid to find start and end of this group in this column \
279-
TO DO?: not if mult=first|last and col<ncol-1 */ \
279+
todo: not if mult=first|last and col<ncol-1 */ \
280280
int tmplow = mid; \
281281
while (tmplow<xupp-1) { \
282282
int mid = tmplow + (xupp-tmplow)/2; \
@@ -341,7 +341,7 @@ void bmerge_r(int xlowIn, int xuppIn, int ilowIn, int iuppIn, int col, int thisg
341341
} \
342342
} \
343343
int tmplow = lir; \
344-
while (tmplow<iupp-1) { /* TO DO: could double up from lir rather than halving from iupp */ \
344+
while (tmplow<iupp-1) { /* todo: could double up from lir rather than halving from iupp */ \
345345
int mid = tmplow + (iupp-tmplow)/2; \
346346
if (WRAP(icv[ o ? o[mid]-1 : mid ]) == IVAL) tmplow=mid; else iupp=mid; \
347347
/* if we could guarantee ivals to be *always* sorted for all columns independently \
@@ -375,7 +375,7 @@ void bmerge_r(int xlowIn, int xuppIn, int ilowIn, int iuppIn, int col, int thisg
375375
#define WRAP(x) (ENC2UTF8(x))
376376
DO(int tmp=StrCmp(ENC2UTF8(xcv[XIND(mid)]), ival), tmp<0, tmp>0, int, 0, 0, ival)
377377
// NA_STRING are allowed and joined to; does not do ENC2UTF8 again inside StrCmp
378-
// TO DO: deal with mixed encodings and locale optionally; could StrCmp non-ascii in a thread-safe non-alloc manner
378+
// todo: deal with mixed encodings and locale optionally; could StrCmp non-ascii in a thread-safe non-alloc manner
379379
} break;
380380
case REALSXP :
381381
if (INHERITS(xc, char_integer64)) {
@@ -391,7 +391,7 @@ void bmerge_r(int xlowIn, int xuppIn, int ilowIn, int iuppIn, int col, int thisg
391391
const double *icv = REAL(ic);
392392
const double *xcv = REAL(xc);
393393
const double ival = icv[ir];
394-
const uint64_t ivalt = dtwiddle(ival); // TO: remove dtwiddle by dealing with NA, NaN, -Inf, +Inf up front
394+
const uint64_t ivalt = dtwiddle(ival); // todo: remove dtwiddle by dealing with NA, NaN, -Inf, +Inf up front
395395
#undef ISNAT
396396
#undef WRAP
397397
#define ISNAT(x) (ISNAN(x))

src/data.table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
// always be checked in UTF8 locale. This seems to be the best fix Arun could think of to put the encoding issues to rest.
7171
// Since the if-statement will fail with the first condition check in "normal" ASCII cases, there shouldn't be huge penalty issues in
7272
// most cases. Fix for #66, #69, #469 and #1293
73-
// TODO: compare 1.9.6 performance with 1.9.7 with huge number of ASCII strings, and again after Jan 2018 when made macro.
73+
// todo: compare 1.9.6 performance with 1.9.7 with huge number of ASCII strings, and again after Jan 2018 when made macro.
7474
// Matt moved this to be macro in Jan 2018 so that branch can benefit from branch prediction too wherever used inside loops.
7575
// This IS_ASCII will dereference s and that cache fetch is the part that may bite more than the branch, though. Without a call to
7676
// to ENC2UTF as all, the pointer value can just be compared by the calling code without dereferencing it. It may still be worth

src/dogroups.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
9292
double nextTime = (showProgress) ? startTime+3 : 0; // wait 3 seconds before printing progress
9393

9494
defineVar(sym_BY, BY = PROTECT(allocVector(VECSXP, ngrpcols)), env); nprotect++; // PROTECT for rchk
95-
SEXP bynames = PROTECT(allocVector(STRSXP, ngrpcols)); nprotect++; // TO DO: do we really need bynames, can we assign names afterwards in one step?
95+
SEXP bynames = PROTECT(allocVector(STRSXP, ngrpcols)); nprotect++; // todo: do we really need bynames, can we assign names afterwards in one step?
9696
for (int i=0; i<ngrpcols; ++i) {
9797
int j = INTEGER(grpcols)[i]-1;
9898
SET_VECTOR_ELT(BY, i, allocVector(TYPEOF(VECTOR_ELT(groups, j)),
99-
nrowgroups ? 1 : 0)); // TODO: might be able to be 1 always but 0 when 'groups' are integer(0) seem sensible. #2440 was involved in the past.
99+
nrowgroups ? 1 : 0)); // todo: might be able to be 1 always but 0 when 'groups' are integer(0) seem sensible. #2440 was involved in the past.
100100
// Fix for #36, by cols with attributes when also used in `j` lost the attribute.
101101
copyMostAttrib(VECTOR_ELT(groups, j), VECTOR_ELT(BY,i)); // not names, otherwise test 778 would fail
102102
SET_STRING_ELT(bynames, i, STRING_ELT(getAttrib(groups,R_NamesSymbol), j));
@@ -109,7 +109,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
109109
R_LockBinding(sym_BY, env);
110110
if (isNull(jiscols) && (length(bynames)!=length(groups) || length(bynames)!=length(grpcols)))
111111
error("!length(bynames)[%d]==length(groups)[%d]==length(grpcols)[%d]", length(bynames), length(groups), length(grpcols)); // # notranslate
112-
// TO DO: check this check above.
112+
// todo: check this check above.
113113

114114
N = PROTECT(findVar(install(".N"), env)); nprotect++; // PROTECT for rchk
115115
SET_TRUELENGTH(N, -1); // marker for anySpecialStatic(); see its comments
@@ -183,7 +183,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
183183
// Previously had replaced (i>0 || !isNull(lhs)) with i>0 to fix #49
184184
// The above is now to fix #1993, see test 1746.
185185
// In cases were no i rows match, '|| estn>-1' ensures that the last empty group creates an empty result.
186-
// TODO: revisit and tidy
186+
// todo: revisit and tidy
187187

188188
if (!isNull(lhs) &&
189189
(istarts[i] == NA_INTEGER ||
@@ -227,7 +227,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
227227
// Or in the words, this entire section, and this entire dogroups.c file, is now write-barrier compliant from v1.12.10
228228
// and we hope that reference counting on by default from R 4.0 will avoid costly gc()s.
229229
}
230-
grpn = 1; // it may not be 1 e.g. test 722. TODO: revisit.
230+
grpn = 1; // it may not be 1 e.g. test 722. todo: revisit.
231231
SETLENGTH(I, grpn);
232232
INTEGER(I)[0] = 0;
233233
for (int j=0; j<length(xSD); ++j) {
@@ -361,7 +361,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
361361
estn = 0;
362362
for (int j=0; j<LENGTH(lens); ++j) estn+=ilens[j];
363363
// Common case 2 : j returns as many rows as there are in the group (maybe a join)
364-
// TO DO: this might over allocate if first group has 1 row and j is actually a single row aggregate
364+
// todo: this might over allocate if first group has 1 row and j is actually a single row aggregate
365365
// in cases when we're not sure could wait for the first few groups before deciding.
366366
} else // maxn < grpn
367367
estn = maxn * LENGTH(starts);
@@ -463,7 +463,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
463463
if (firstalloc) {
464464
nprotect++; // remember the first jval. If we UNPROTECTed now, we'd unprotect
465465
firstalloc = FALSE; // ans. The first jval is needed to create the right size and type of ans.
466-
// TO DO: could avoid this last 'if' by adding a dummy PROTECT after first alloc for this UNPROTECT(1) to do.
466+
// todo: could avoid this last 'if' by adding a dummy PROTECT after first alloc for this UNPROTECT(1) to do.
467467
}
468468
else UNPROTECT(1); // the jval. Don't want them to build up. The first jval can stay protected till the end ok.
469469
}
@@ -479,7 +479,7 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
479479
if (verbose) Rprintf(_("Wrote less rows (%d) than allocated (%d).\n"),ansloc,LENGTH(VECTOR_ELT(ans,0)));
480480
for (int j=0; j<length(ans); j++) SET_VECTOR_ELT(ans, j, growVector(VECTOR_ELT(ans,j), ansloc));
481481
// shrinks (misuse of word 'grow') back to the rows written, otherwise leak until ...
482-
// ... TO DO: set truelength to LENGTH(VECTOR_ELT(ans,0)), length to ansloc and enhance finalizer to handle over-allocated rows.
482+
// ... todo: set truelength to LENGTH(VECTOR_ELT(ans,0)), length to ansloc and enhance finalizer to handle over-allocated rows.
483483
}
484484
} else ans = R_NilValue;
485485
// Now reset length of .SD columns and .I to length of largest group, otherwise leak if the last group is smaller (often is).
@@ -533,7 +533,7 @@ SEXP growVector(SEXP x, const R_len_t newlen)
533533
SEXP newx;
534534
R_len_t len = length(x);
535535
if (isNull(x)) error(_("growVector passed NULL"));
536-
PROTECT(newx = allocVector(TYPEOF(x), newlen)); // TO DO: R_realloc(?) here?
536+
PROTECT(newx = allocVector(TYPEOF(x), newlen)); // todo: R_realloc(?) here?
537537
if (newlen < len) len=newlen; // i.e. shrink
538538
if (!len) { // cannot memcpy invalid pointer, #6819
539539
keepattr(newx, x);

src/fastmean.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ SEXP fastmean(SEXP args)
6161
break;
6262
case REALSXP:
6363
for (int i=0; i<l; ++i) {
64-
if(ISNAN(REAL(x)[i])) continue; // TO DO: could drop this line and let NA propagate?
64+
if(ISNAN(REAL(x)[i])) continue; // todo: could drop this line and let NA propagate?
6565
s += REAL(x)[i];
6666
n++;
6767
}

src/fcast.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// #include <signal.h> // the debugging machinery + breakpoint aidee
44
// raise(SIGINT);
55

6-
// TO DO: margins
6+
// todo: margins
77
SEXP fcast(SEXP lhs, SEXP val, SEXP nrowArg, SEXP ncolArg, SEXP idxArg, SEXP fill, SEXP fill_d, SEXP is_agg, SEXP some_fillArg) {
88
int nrows=INTEGER(nrowArg)[0], ncols=INTEGER(ncolArg)[0];
99
int nlhs=length(lhs), nval=length(val), *idx = INTEGER(idxArg);
@@ -127,7 +127,7 @@ SEXP fcast(SEXP lhs, SEXP val, SEXP nrowArg, SEXP ncolArg, SEXP idxArg, SEXP fil
127127
// if (TYPEOF(env) != ENVSXP) error(_("Argument 'env' to (data.table internals) 'cast_order' must be an environment"));
128128
// if (TYPEOF(v) == VECSXP) len = length(VECTOR_ELT(v, 0));
129129
// else len = length(v);
130-
// PROTECT(call = lang2(install("forder"), v)); // TODO: save the 'eval' by calling directly the C-function.
130+
// PROTECT(call = lang2(install("forder"), v)); // todo: save the 'eval' by calling directly the C-function.
131131
// ans = PROTECT(eval(call, env));
132132
// if (length(ans) == 0) { // forder returns integer(0) if already sorted
133133
// UNPROTECT(1); // ans

0 commit comments

Comments
 (0)