From: Willy Tarreau Date: Mon, 2 Nov 2020 19:15:40 +0000 (+0100) Subject: MINOR: pattern: perform a single call to pat_delete_gen() under the expression X-Git-Tag: v2.4-dev1~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e828d8f0e8b88b8ee16e2cc5293025220d0b9265;p=thirdparty%2Fhaproxy.git MINOR: pattern: perform a single call to pat_delete_gen() under the expression When we're removing an element under the expression lock, we don't need anymore to run over all ->delete() functions via the expressions, since we know that the single function does it fine now. Note that at this point, pattern->delete() is not used at all through out the code anymore. --- diff --git a/src/pattern.c b/src/pattern.c index 0a2032e6d9..89a5c4844b 100644 --- a/src/pattern.c +++ b/src/pattern.c @@ -1527,11 +1527,11 @@ int pat_ref_delete_by_id(struct pat_ref *ref, struct pat_ref_elt *refelt) bref->ref = elt->list.n; } + /* delete all entries from all expressions for this pattern */ list_for_each_entry(expr, &ref->pat, list) HA_RWLOCK_WRLOCK(PATEXP_LOCK, &expr->lock); - list_for_each_entry(expr, &ref->pat, list) - expr->pat_head->delete(expr->ref, elt); + pat_delete_gen(ref, elt); list_for_each_entry(expr, &ref->pat, list) HA_RWLOCK_WRUNLOCK(PATEXP_LOCK, &expr->lock); @@ -1577,8 +1577,7 @@ int pat_ref_delete(struct pat_ref *ref, const char *key) list_for_each_entry(expr, &ref->pat, list) HA_RWLOCK_WRLOCK(PATEXP_LOCK, &expr->lock); - list_for_each_entry(expr, &ref->pat, list) - expr->pat_head->delete(expr->ref, elt); + pat_delete_gen(ref, elt); list_for_each_entry(expr, &ref->pat, list) HA_RWLOCK_WRUNLOCK(PATEXP_LOCK, &expr->lock);