Skip to content

Commit

Permalink
input/csv: trim whitespace after eliminating comments
Browse files Browse the repository at this point in the history
Accept when comments are indented, trim the whitespace from text lines
after stripping off the comment. This avoids the processing of lines
which actually are empty, and improves robustness (avoids errors for a
non-fatal situation). Also results in more appropriate diagnostics at
higher log levels.
  • Loading branch information
gsigh committed Dec 21, 2019
1 parent c6aa987 commit b2c4dde
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/input/csv.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,10 @@ static void strip_comment(char *buf, const GString *prefix)
if (!prefix->len)
return;

if ((ptr = strstr(buf, prefix->str)))
if ((ptr = strstr(buf, prefix->str))) {
*ptr = '\0';
g_strstrip(buf);
}
}

static int parse_binstr(const char *str, struct context *inc)
Expand Down

0 comments on commit b2c4dde

Please sign in to comment.