diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-07-19 13:33:51 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-07-19 13:33:51 -0700 |
| commit | 62e7d654bd70db89cb38e5d9efeb9a9b0e9cf202 (patch) | |
| tree | df30269408b01adff18904cd4aa04d57866caaae | |
| parent | 01410bd09d3fdbeb40f72999e46aefa99e205e73 (diff) | |
Disable optimization when `skip` is non-null
| -rw-r--r-- | match.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; |
