oops parser: add/use skip_space; fix skip_spaces

The former skip_spaces() function only skipped a single space, so rename
it to skip_space(), and make skip_spaces() greedily consume spaces.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This commit is contained in:
Patrick McCarty
2017-03-21 22:55:03 -07:00
committed by Robert Nesius
parent 3d24527096
commit 266039a4e5
+12 -2
View File
@@ -184,7 +184,7 @@ char *skip_timestamp(char *line)
return start;
}
char *skip_spaces(char *line)
char *skip_space(char *line)
{
char *start = line;
@@ -194,6 +194,16 @@ char *skip_spaces(char *line)
return start;
}
char *skip_spaces(char *line)
{
char *start = line;
while (*start && isspace(*start)) {
start++;
}
return start;
}
bool starts_with(const char *line, const char *line_end, const char *substr)
{
size_t substrlen = strlen(substr);
@@ -346,7 +356,7 @@ void parse_single_line(char *line, size_t size)
line_end = line + size;
start = skip_log_level(line);
start = skip_timestamp(start);
start = skip_spaces(start);
start = skip_space(start);
struct oops_pattern *pattern;
if (oops_msg.length == 0) {