From b248b1c02175f190a03c1ff9258be03514320a8c Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 2 Feb 2026 09:31:37 +0100 Subject: [PATCH] CLEANUP: compression: Remove unused static buffers 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 | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c index c4b29833a..002d074eb 100644 --- a/src/flt_http_comp.c +++ b/src/flt_http_comp.c @@ -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,