diff --git a/NEWS.md b/NEWS.md index 19fc575e0d..949e93ace3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -603,6 +603,7 @@ 16. The options `datatable.print.class` and `datatable.print.keys` are now `TRUE` by default. They have been available since v1.9.8 (Nov 2016) and v1.11.0 (May 2018) respectively. +17. A defunct code path in `fread` was removed. The code, which had been present for four years, was intended as an optimization for `na.strings = ""` but due to an error was never actually used. The error was uncovered by CRAN's continuous testing which uses a variety of environments to build and test R packages. One of these uses the latest version of the GCC compiler which newly warns on the type of error present here. Thanks to Václav Tlapák for investigating [#5733](https://github.com/Rdatatable/data.table/issues/5377) and the PR [#5399](https://github.com/Rdatatable/data.table/pull/5399). # data.table [v1.14.2](https://github.com/Rdatatable/data.table/milestone/24?closed=1) (27 Sep 2021) diff --git a/src/fread.c b/src/fread.c index 04df88d9c2..dde610e047 100644 --- a/src/fread.c +++ b/src/fread.c @@ -281,7 +281,7 @@ static inline const char *end_NA_string(const char *start) { // start should be at the beginning of any potential NA string, after leading whitespace skipped by caller const char* const* nastr = NAstrings; const char *mostConsumed = start; // tests 1550* includes both 'na' and 'nan' in nastrings. Don't stop after 'na' if 'nan' can be consumed too. - if (nastr) while (*nastr) { + while (*nastr) { const char *ch1 = start; const char *ch2 = *nastr; while (*ch1==*ch2 && *ch2!='\0') { ch1++; ch2++; } @@ -1283,8 +1283,6 @@ int freadMain(freadMainArgs _args) { while (*nastr) { if (**nastr == '\0') { blank_is_a_NAstring = true; - // if blank is the only one, as is the default, clear NAstrings so that doesn't have to be checked - if (nastr==NAstrings && nastr+1==NULL) NAstrings=NULL; nastr++; continue; }