aboutsummaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-09-26 13:12:02 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-09-26 13:12:02 -0700
commit77d9007a88a18e0dee08aa9ba93e3aec86375572 (patch)
tree5dddf51ce1dfba7fe5272fc024bb839868a789ab /match.c
parentee0174001b385944c6a2b3b1fb6ba861613cb4f7 (diff)
Refactor of pat_t memory management to use doubly linked lists, and
moving the recursive freeing code from Lua/lbp.c into pattern.c
Diffstat (limited to 'match.c')
-rw-r--r--match.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/match.c b/match.c
index 874f60a..5ae9f0f 100644
--- a/match.c
+++ b/match.c
@@ -531,10 +531,8 @@ static match_t *match(match_ctx_t *ctx, const char *str, pat_t *pat)
ctx2.defs = with_def(ctx->defs, m1->pat->args.capture.namelen, m1->pat->args.capture.name, backref);
++m1->refcount; {
m2 = match(&ctx2, m1->end, pat->args.multiple.second);
- if (!m2) { // No need to keep the backref in memory if it didn't match
- free_pat(backref);
- backref = NULL;
- }
+ if (!m2) // No need to keep the backref in memory if it didn't match
+ delete_pat(&backref, false);
free_defs(ctx2.defs, ctx->defs);
} --m1->refcount;
} else {