From 62e7d654bd70db89cb38e5d9efeb9a9b0e9cf202 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 19 Jul 2021 13:33:51 -0700 Subject: Disable optimization when `skip` is non-null --- match.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'match.c') diff --git a/match.c b/match.c index 240e2fa..c62a068 100644 --- a/match.c +++ b/match.c @@ -108,7 +108,7 @@ match_t *next_match(def_t *defs, file_t *f, match_t *prev, pat_t *pat, pat_t *sk // Performance optimization: if the pattern starts with a string literal, // we can just rely on the highly optimized strstr()/strcasestr() // implementations to skip past areas where we know we won't find a match. - if (first->type == BP_STRING) { + if (!skip && first->type == BP_STRING) { for (size_t i = 0; i < first->min_matchlen; i++) if (first->args.string[i] == '\0') goto pattern_search; -- cgit v1.2.3