Skip to content

Commit 98e2196

Browse files
committed
also renamed the parser array itself. 'fun' is not very descriptive
1 parent ec0aa0b commit 98e2196

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/fread.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,13 +1206,13 @@ static void parse_bool_yn(FieldParseContext *ctx)
12061206

12071207
/* How to register a new parser
12081208
* (1) Write the parser
1209-
* (2) Add it to fun array here
1209+
* (2) Add it to parser_funs array here
12101210
* (3) Extend disabled_parsers, typeName, and typeSize here as appropriate
12111211
* (4) Extend colType typdef in fread.h as appropriate
12121212
* (5) Extend typeSxp, typeRName, typeEnum in freadR.c as appropriate
12131213
*/
12141214
typedef void (*reader_fun_t)(FieldParseContext *ctx);
1215-
static const reader_fun_t fun[NUMTYPE] = {
1215+
static const reader_fun_t parser_funs[NUMTYPE] = {
12161216
&Field, // CT_DROP
12171217
&parse_empty, // CT_EMPTY
12181218
&parse_bool_10,
@@ -1260,11 +1260,11 @@ static int detect_types(const char **pch, int ncol, bool *bumped)
12601260
dec = '.';
12611261
}
12621262

1263-
fun[tmpType[field]](&fctx);
1263+
parser_funs[tmpType[field]](&fctx);
12641264
if (end_of_field(ch)) break;
12651265
skip_white(&ch);
12661266
if (end_of_field(ch)) break;
1267-
ch = end_NA_string(fieldStart); // fieldStart here is correct (already after skip_white above); fun[]() may have part processed field so not ch
1267+
ch = end_NA_string(fieldStart); // fieldStart here is correct (already after skip_white above); parser_funs[]() may have part processed field so not ch
12681268
skip_white(&ch);
12691269
if (end_of_field(ch)) break;
12701270
ch = fieldStart;
@@ -1275,7 +1275,7 @@ static int detect_types(const char **pch, int ncol, bool *bumped)
12751275
}
12761276
if (*ch == quote && quote) { // && quote to exclude quote='\0' (user passed quote="")
12771277
ch++;
1278-
fun[tmpType[field]](&fctx);
1278+
parser_funs[tmpType[field]](&fctx);
12791279
if (*ch == quote) {
12801280
ch++;
12811281
skip_white(&ch);
@@ -2459,7 +2459,7 @@ int freadMain(freadMainArgs _args)
24592459
// DTPRINT(_("Field %d: '%.10s' as type %d (tch=%p)\n"), j+1, tch, type[j], tch);
24602460
fieldStart = tch;
24612461
int8_t thisType = type[j]; // fetch shared type once. Cannot read half-written byte is one reason type's type is single byte to avoid atomic read here.
2462-
fun[IGNORE_BUMP(thisType)](&fctx);
2462+
parser_funs[IGNORE_BUMP(thisType)](&fctx);
24632463
if (*tch != sep) break;
24642464
int8_t thisSize = size[j];
24652465
if (thisSize) ((char**) targets)[thisSize] += thisSize; // 'if' for when rereading to avoid undefined NULL+0
@@ -2523,7 +2523,7 @@ int freadMain(freadMainArgs _args)
25232523
if (!end_of_field(tch)) tch = afterSpace; // else it is the field_end, we're on closing sep|eol and we'll let processor write appropriate NA as if field was empty
25242524
if (*tch == quote && quote) { quoted = true; tch++; }
25252525
} // else Field() handles NA inside it unlike other processors e.g. ,, is interpreted as "" or NA depending on option read inside Field()
2526-
fun[IGNORE_BUMP(thisType)](&fctx);
2526+
parser_funs[IGNORE_BUMP(thisType)](&fctx);
25272527

25282528
bool typeBump = false;
25292529
if (quoted) { // quoted was only set to true with '&& quote' above (=> quote!='\0' now)

0 commit comments

Comments
 (0)