Skip to content

Commit 87ba151

Browse files
committed
add comments for helpers
1 parent efd8797 commit 87ba151

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/fread.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,14 @@ static inline void skip_white(const char **pch)
267267
*pch = ch;
268268
}
269269

270+
/**
271+
* Advance `ch` past spaces/NULs until we hit a comment marker or the first
272+
* non-whitespace character. Leaves `ch` unchanged if already on content.
273+
*/
270274
static inline const char *skip_to_comment_or_nonwhite(const char *ch)
271275
{
272276
while (ch < eof && (*ch == ' ' || *ch == '\t' || *ch == '\0')) {
273-
if (commentChar && *ch == commentChar) break;
277+
if (commentChar && *ch == commentChar) break; // comment char might be space or tab
274278
ch++;
275279
}
276280
return ch;
@@ -301,15 +305,17 @@ static inline bool eol(const char **pch)
301305
return eol_one_r && **pch == '\r';
302306
}
303307

304-
308+
/**
309+
* Walk to the start of the next line (or `eof` if none) by skipping the
310+
* current line's contents and its newline sequence.
311+
*/
305312
static inline const char *skip_line(const char *ch, const char *eof) {
306313
while (ch < eof && *ch != '\n' && *ch != '\r')
307314
ch++;
308315
if (ch < eof && eol(&ch)) ch++;
309316
return ch;
310317
}
311318

312-
313319
/**
314320
* Return True iff `ch` is a valid field terminator character: either a field
315321
* separator or a newline.

0 commit comments

Comments
 (0)