summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/filter.c4
-rw-r--r--src/flexdef.h2
-rw-r--r--src/regex.c4
3 files changed, 4 insertions, 6 deletions
diff --git a/src/filter.c b/src/filter.c
index fd1bb40..ccdcdd6 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -326,7 +326,9 @@ int filter_tee_header (struct filter *chain)
static bool is_blank_line (const char *str)
{
- return (regexec (&regex_blank_line, str, 0, NULL, 0) == 0);
+ while (isspace(*str))
+ str++;
+ return (*str == '\0');
}
/** Adjust the line numbers in the #line directives of the generated scanner.
diff --git a/src/flexdef.h b/src/flexdef.h
index 9dac654..3bbaea1 100644
--- a/src/flexdef.h
+++ b/src/flexdef.h
@@ -1131,7 +1131,7 @@ extern int filter_fix_linedirs(struct filter *chain);
* From "regex.c"
*/
-extern regex_t regex_linedir, regex_blank_line;
+extern regex_t regex_linedir;
bool flex_init_regex(void);
void flex_regcomp(regex_t *preg, const char *regex, int cflags);
char *regmatch_dup (regmatch_t * m, const char *src);
diff --git a/src/regex.c b/src/regex.c
index 38e658b..f4c4163 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -25,10 +25,8 @@
static const char* REGEXP_LINEDIR = "^#line ([[:digit:]]+) \"(.*)\"";
-static const char* REGEXP_BLANK_LINE = "^[[:space:]]*$";
regex_t regex_linedir; /**< matches line directives */
-regex_t regex_blank_line; /**< matches blank lines */
/** Initialize the regular expressions.
@@ -37,8 +35,6 @@ regex_t regex_blank_line; /**< matches blank lines */
bool flex_init_regex(void)
{
flex_regcomp(&regex_linedir, REGEXP_LINEDIR, REG_EXTENDED);
- flex_regcomp(&regex_blank_line, REGEXP_BLANK_LINE, REG_EXTENDED);
-
return true;
}