From: Remi Tricot-Le Breton Date: Wed, 7 Oct 2026 15:26:34 +0000 (+0200) Subject: MINOR: cache: Remove a useless variable in http_action_req_cache_use X-Git-Tag: v3.5-dev9~32 X-Git-Url: https://git.kaiwu.me/$%7BISSUES%7D/static/gitweb.js?a=commitdiff_plain;h=5ded8149a5535b5a6019f561dac94ed95a5bb99d;p=haproxy.git MINOR: cache: Remove a useless variable in http_action_req_cache_use The only case in which the 'detached' variable keeps its default value of 0, the 'res' variable has to be set to NULL so all the checks on 'detached' that happen later are always true since they are called in a 'if (res && res->secondary_key_signature)' block. The 'detached' variable can then be removed completely. --- diff --git a/src/cache.c b/src/cache.c index dde567996..83173a87b 100644 --- a/src/cache.c +++ b/src/cache.c @@ -2695,7 +2695,6 @@ enum act_return http_action_req_cache_use(struct act_rule *rule, struct proxy *p * Vary). */ if (res) { struct appctx *appctx; - int detached = 0; entry_block = block_ptr(res); shctx_wrlock(shctx); @@ -2710,7 +2709,6 @@ enum act_return http_action_req_cache_use(struct act_rule *rule, struct proxy *p */ retain_entry(res); shctx_row_detach(shctx, entry_block); - detached = 1; } else { /* p[1] holds the "no-early-hints" opt-out set by parse_cache_use(). */ if ((cache->flags & CACHE_CF_EARLY_HINTS) && !rule->arg.act.p[1] && @@ -2788,12 +2786,12 @@ enum act_return http_action_req_cache_use(struct act_rule *rule, struct proxy *p * not from here, see below. */ to_release = res; - to_reattach = detached ? block_ptr(res) : NULL; + to_reattach = block_ptr(res); } else if (sec_entry != res) { /* The wrong row was added to the hot list. */ to_release = res; - to_reattach = detached ? block_ptr(res) : NULL; + to_reattach = block_ptr(res); shctx_wrlock(shctx); /* Same as for the primary entry above: retain * this one under the lock that detaches its