Skip to content

Commit 73590c4

Browse files
committed
refactor end_of_field helper into more readable version
1 parent 9288dd1 commit 73590c4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/fread.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,10 @@ static inline bool end_of_field(const char *ch)
349349
// \0 (maybe more than one) before eof are part of field and do not end it; eol() returns false for \0 but the ch==eof will return true for the \0 at eof.
350350
// Comment characters terminate a field immediately and take precedence over separators.
351351
return *ch == sep || ((uint8_t)*ch <= 13 && (ch == eof || eol(&ch))) || (commentChar && *ch == commentChar);
352+
if (*ch == sep) return true;
353+
if ((uint8_t)*ch <= 13 && (ch == eof || eol(&ch))) return true;
354+
if (!commentChar) return false;
355+
return *ch == commentChar;
352356
}
353357

354358
static inline const char *end_NA_string(const char *start)

0 commit comments

Comments
 (0)