Skip to content

Commit f248d33

Browse files
authored
Replace GetOption with GetOption1 (#6849)
GetOption1() has been available since R-2.13, and GetOption() has been ignoring its second argument for a long time, so there's no portability cost.
1 parent 05e3bdf commit f248d33

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/forder.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,7 @@ void putIndex(SEXP x, SEXP cols, SEXP o) {
16161616

16171617
// isTRUE(getOption("datatable.use.index"))
16181618
bool GetUseIndex(void) {
1619-
SEXP opt = GetOption(install("datatable.use.index"), R_NilValue);
1619+
SEXP opt = GetOption1(install("datatable.use.index"));
16201620
if (!IS_TRUE_OR_FALSE(opt))
16211621
error(_("'datatable.use.index' option must be TRUE or FALSE")); // # nocov
16221622
return LOGICAL(opt)[0];
@@ -1627,7 +1627,7 @@ bool GetAutoIndex(void) {
16271627
// for now temporarily 'forder.auto.index' not 'auto.index' to disabled it by default
16281628
// because it writes attr on .SD which is re-used by all groups leading to incorrect results
16291629
// DT[, .(uN=uniqueN(.SD)), by=A]
1630-
SEXP opt = GetOption(install("datatable.forder.auto.index"), R_NilValue);
1630+
SEXP opt = GetOption1(install("datatable.forder.auto.index"));
16311631
if (isNull(opt))
16321632
return false;
16331633
if (!IS_TRUE_OR_FALSE(opt))

src/freadR.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ SEXP freadR(
132132
args.logical01 = LOGICAL(logical01Arg)[0];
133133
args.logicalYN = LOGICAL(logicalYNArg)[0];
134134
{
135-
SEXP tt = PROTECT(GetOption(sym_old_fread_datetime_character, R_NilValue));
135+
SEXP tt = PROTECT(GetOption1(sym_old_fread_datetime_character));
136136
args.oldNoDateTime = oldNoDateTime = isLogical(tt) && LENGTH(tt)==1 && LOGICAL(tt)[0]==TRUE;
137137
UNPROTECT(1);
138138
}

src/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ inline double LLtoD(long long x) {
329329

330330
int GetVerbose(void) {
331331
// don't call repetitively; save first in that case
332-
SEXP opt = GetOption(sym_verbose, R_NilValue);
332+
SEXP opt = GetOption1(sym_verbose);
333333
if ((!isLogical(opt) && !isInteger(opt)) || LENGTH(opt)!=1 || INTEGER(opt)[0]==NA_INTEGER)
334334
error(_("verbose option must be length 1 non-NA logical or integer"));
335335
return INTEGER(opt)[0];

src/rbindlist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ SEXP rbindlist(SEXP l, SEXP usenamesArg, SEXP fillArg, SEXP idcolArg, SEXP ignor
228228
}
229229
}
230230
if (buff[0]) {
231-
SEXP opt = GetOption(install("datatable.rbindlist.check"), R_NilValue);
231+
SEXP opt = GetOption1(install("datatable.rbindlist.check"));
232232
if (!isNull(opt) && !(isString(opt) && length(opt)==1)) {
233233
warning(_("options()$datatable.rbindlist.check is set but is not a single string. See news item 5 in v1.12.2."));
234234
opt = R_NilValue;

src/subset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ SEXP subsetDT(SEXP x, SEXP rows, SEXP cols) { // API change needs update NEWS.md
296296
if (this<1 || this>LENGTH(x)) error(_("Item %d of cols is %d which is outside the range [1,ncol(x)=%d]"), i+1, this, LENGTH(x));
297297
}
298298

299-
int overAlloc = checkOverAlloc(GetOption(install("datatable.alloccol"), R_NilValue));
299+
int overAlloc = checkOverAlloc(GetOption1(install("datatable.alloccol")));
300300
SEXP ans = PROTECT(allocVector(VECSXP, LENGTH(cols)+overAlloc)); nprotect++; // doing alloc.col directly here; eventually alloc.col can be deprecated.
301301

302302
// user-defined and superclass attributes get copied as from v1.12.0

0 commit comments

Comments
 (0)