]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: compression: Remove unused static buffers
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 2 Feb 2026 08:31:37 +0000 (09:31 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 18 Feb 2026 08:44:15 +0000 (09:44 +0100)
Since the legacy HTTP code was removed, the global and thread-local buffers,
tmpbuf and zbuf, are no longer used. So let's removed them.

This could be backported, theorically to all supported versions. But at
least it could be good to do so as far as 3.2 as it saves 2 buffers
per-thread.

src/flt_http_comp.c

index c4b29833a6318e8e2ea162023238d76e374dc2ef..002d074eb2bcdff131cac91f261234752acb30e4 100644 (file)
@@ -44,9 +44,6 @@ struct comp_state {
 /* Pools used to allocate comp_state structs */
 DECLARE_STATIC_TYPED_POOL(pool_head_comp_state, "comp_state", struct comp_state);
 
-static THREAD_LOCAL struct buffer tmpbuf;
-static THREAD_LOCAL struct buffer zbuf;
-
 static int select_compression_request_header(struct comp_state *st,
                                             struct stream *s,
                                             struct http_msg *msg);
@@ -70,25 +67,6 @@ comp_flt_init(struct proxy *px, struct flt_conf *fconf)
        return 0;
 }
 
-static int
-comp_flt_init_per_thread(struct proxy *px, struct flt_conf *fconf)
-{
-       if (b_alloc(&tmpbuf, DB_PERMANENT) == NULL)
-               return -1;
-       if (b_alloc(&zbuf, DB_PERMANENT) == NULL)
-               return -1;
-       return 0;
-}
-
-static void
-comp_flt_deinit_per_thread(struct proxy *px, struct flt_conf *fconf)
-{
-       if (tmpbuf.size)
-               b_free(&tmpbuf);
-       if (zbuf.size)
-               b_free(&zbuf);
-}
-
 static int
 comp_strm_init(struct stream *s, struct filter *filter)
 {
@@ -789,8 +767,6 @@ htx_compression_buffer_end(struct comp_state *st, struct buffer *out, int end, i
 /***********************************************************************/
 struct flt_ops comp_ops = {
        .init              = comp_flt_init,
-       .init_per_thread   = comp_flt_init_per_thread,
-       .deinit_per_thread = comp_flt_deinit_per_thread,
 
        .attach = comp_strm_init,
        .detach = comp_strm_deinit,