summaryrefslogtreecommitdiff
path: root/src/filter.c
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2017-07-08 20:21:37 +0800
committerWill Estes <westes575@gmail.com>2017-07-15 18:31:41 -0400
commite784a805ef8f33ab4de544eee1876f41d2bd9dbc (patch)
tree25ce5f4a583a8d45111e854756ca200d92d71d7e /src/filter.c
parent0f370436e1cf0c731e74bcee806df6c7a43a3094 (diff)
filter: faster is_blank_line implementation
Using regex_t regex_blank_line is *slow*.
Diffstat (limited to 'src/filter.c')
-rw-r--r--src/filter.c4
1 files changed, 3 insertions, 1 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.