It's simply to return (regexec(®ex_blank_line, str, 0, NULL, 0) == 0);
The reason for encapsulation is to allow replacing this with a
non-regex method if necessary.
return 0;
}
+static bool is_blank_line (const char *str)
+{
+ return (regexec (®ex_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,
}
/* squeeze blank lines from generated code */
- else if (in_gen
- && regexec (®ex_blank_line, buf, 0, NULL,
- 0) == 0) {
+ else if (in_gen && is_blank_line(buf)) {
if (last_was_blank)
continue;
else