summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/filter.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/filter.c b/src/filter.c
index 35b80a9..fd1bb40 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -324,6 +324,11 @@ int filter_tee_header (struct filter *chain)
return 0;
}
+static bool is_blank_line (const char *str)
+{
+ return (regexec (&regex_blank_line, str, 0, NULL, 0) == 0);
+}
+
/** Adjust the line numbers in the #line directives of the generated scanner.
* After the m4 expansion, the line numbers are incorrect since the m4 macros
* can add or remove lines. This only adjusts line numbers for generated code,
@@ -395,9 +400,7 @@ int filter_fix_linedirs (struct filter *chain)
}
/* squeeze blank lines from generated code */
- else if (in_gen
- && regexec (&regex_blank_line, buf, 0, NULL,
- 0) == 0) {
+ else if (in_gen && is_blank_line(buf)) {
if (last_was_blank)
continue;
else