aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-06-16 14:58:19 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-06-16 14:58:19 -0400
commit22015bf6ac80585aec0679d443822213b1b4dd4c (patch)
tree07987df5e5ee9023d59a8165edfde90672f50821
parent46c2edd4d1c2c5d0244ea8e216299d4e6db60a6b (diff)
Rollback '..' optimization because it incorrectly skips ahead multiple
lines
-rw-r--r--match.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/match.c b/match.c
index f05089f..1ecee6d 100644
--- a/match.c
+++ b/match.c
@@ -446,22 +446,6 @@ static bp_match_t *match(match_ctx_t *ctx, const char *str, bp_pat_t *pat)
return m;
}
- // Optimization: for simple cases like `.."foo"` we can speed things up
- // by skipping ahead to strstr(str, "foo")
- if (!skip) {
- bp_pat_t *prereq = get_prerequisite(ctx, target);
- if (prereq->type == BP_STRING && prereq->min_matchlen > 0) {
- char *found = ctx->ignorecase ?
- strcasestr(str, When(prereq, BP_STRING)->string)
- : memmem(str, (size_t)(ctx->end - str), When(prereq, BP_STRING)->string, prereq->min_matchlen);
- str = found ? found : ctx->end;
- } else if (prereq->type == BP_END_OF_FILE) {
- str = ctx->end;
- } else if (prereq->type == BP_END_OF_LINE) {
- str += strcspn(str, "\n\r");
- }
- }
-
size_t child_cap = 0, nchildren = 0;
for (const char *prev = NULL; prev < str; ) {
prev = str;