]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: Reduce scope of `header_name` in http_action_store_cache()
authorTim Duesterhus <tim@bastelstu.be>
Sat, 2 Jan 2021 21:47:16 +0000 (22:47 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 5 Jan 2021 16:05:58 +0000 (17:05 +0100)
This variable is only needed deeply nested in a single location and clang's
static analyzer complains about a dead initialization. Reduce the scope to
satisfy clang and the human that reads the function.

src/cache.c

index a0b417e2ea4419c0af3b6a51baa7e12c3dfc7ab7..b7ea562a7deea6086d662253925a47eb128b8697 100644 (file)
@@ -994,7 +994,6 @@ enum act_return http_action_store_cache(struct act_rule *rule, struct proxy *px,
        struct http_hdr_ctx ctx;
        size_t hdrs_len = 0;
        int32_t pos;
-       struct ist header_name = IST_NULL;
        unsigned int vary_signature = 0;
 
        /* Don't cache if the response came from a cache */
@@ -1181,7 +1180,7 @@ enum act_return http_action_store_cache(struct act_rule *rule, struct proxy *px,
                 * future conditional requests to be able to perform ETag
                 * comparisons. */
                if (type == HTX_BLK_HDR) {
-                       header_name = htx_get_blk_name(htx, blk);
+                       struct ist header_name = htx_get_blk_name(htx, blk);
                        if (isteq(header_name, ist("etag"))) {
                                object->etag_length = sz - istlen(header_name);
                                object->etag_offset = sizeof(struct cache_entry) + b_data(&trash) - sz + istlen(header_name);