aboutsummaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-09-23 14:55:30 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-09-23 14:55:30 -0700
commitd20afd10b693180b667ebdb0bfab7b9afabc0b42 (patch)
treed91d5aa978c28d8a0cccc59e8ef0e6c35f7b18ad /match.c
parent89c5888dd66c09cb304d21e2ce6f96c9cc42461f (diff)
API update: made new_pat() internal and added public bp_backref() to
cover that use case
Diffstat (limited to 'match.c')
-rw-r--r--match.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/match.c b/match.c
index 9644dc0..6089a2d 100644
--- a/match.c
+++ b/match.c
@@ -518,10 +518,7 @@ static match_t *match(def_t *defs, cache_t *cache, file_t *f, const char *str, p
if (m1->pat->type == BP_CAPTURE && m1->pat->args.capture.name) {
// Temporarily add a rule that the backref name matches the
// exact string of the original match (no replacements)
- size_t len = (size_t)(m1->end - m1->start);
- pat_t *backref = new_pat(f, m1->start, m1->end, len, (ssize_t)len, BP_STRING);
- backref->args.string = m1->start;
-
+ pat_t *backref = bp_backref(f, m1);
def_t *defs2 = with_def(defs, m1->pat->args.capture.namelen, m1->pat->args.capture.name, backref);
++m1->refcount; {
m2 = match(defs2, cache, f, m1->end, pat->args.multiple.second, ignorecase);