aboutsummaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-07-29 12:45:37 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-07-29 12:45:37 -0700
commitbc813df3d749971ade565a7cf34aedae6787dc44 (patch)
tree83ebd4020fa82769af3315ab415d0aaace4c7420 /match.c
parentdb969f34a99b5ab5efd3a82d3c6d5a8e9be6f2da (diff)
Tweaks and optimizations
Diffstat (limited to 'match.c')
-rw-r--r--match.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/match.c b/match.c
index 6882c06..d6d69af 100644
--- a/match.c
+++ b/match.c
@@ -497,14 +497,14 @@ static match_t *match(def_t *defs, file_t *f, const char *str, pat_t *pat, bool
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;
- def_t *defs2 = with_def(defs, m1->pat->args.capture.namelen, m1->pat->args.capture.name, backref);
+ def_t *defs2 = with_def(defs, m1->pat->args.capture.namelen, m1->pat->args.capture.name, backref);
++m1->refcount; {
m2 = match(defs2, f, m1->end, pat->args.multiple.second, ignorecase);
if (!m2) { // No need to keep the backref in memory if it didn't match
- for (struct allocated_pat_s **rem = &f->pats; *rem; rem = &(*rem)->next) {
- if (&(*rem)->pat == backref) {
- struct allocated_pat_s *tmp = *rem;
+ for (pat_t **rem = &f->pats; *rem; rem = &(*rem)->next) {
+ if ((*rem) == backref) {
+ pat_t *tmp = *rem;
*rem = (*rem)->next;
free(tmp);
break;