Skip to content

Commit b2c4dde

Browse files
committed
input/csv: trim whitespace after eliminating comments
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.
1 parent c6aa987 commit b2c4dde

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/input/csv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,10 @@ static void strip_comment(char *buf, const GString *prefix)
181181
if (!prefix->len)
182182
return;
183183

184-
if ((ptr = strstr(buf, prefix->str)))
184+
if ((ptr = strstr(buf, prefix->str))) {
185185
*ptr = '\0';
186+
g_strstrip(buf);
187+
}
186188
}
187189

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

0 commit comments

Comments
 (0)