From 7be7ffac157ad72555c4e2fa87ba4a7abcc2f521 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 22 Mar 2021 14:53:56 +0100 Subject: [PATCH] CLEANUP: dynbuf: remove the unused b_alloc_fast() function It is never used anymore since 1.7 where it was used by b_alloc_margin() then replaced by direct calls to the pools function, and it maintains a dependency on the exposed pools functions. It's time to get rid of it, as it's not even certain it still works. --- doc/internals/buffer-api.txt | 12 ------------ include/haproxy/dynbuf.h | 21 --------------------- 2 files changed, 33 deletions(-) diff --git a/doc/internals/buffer-api.txt b/doc/internals/buffer-api.txt index ccace492b..ac353004e 100644 --- a/doc/internals/buffer-api.txt +++ b/doc/internals/buffer-api.txt @@ -554,18 +554,6 @@ b_alloc | buffer *buf | ensures that is allocated or | | The allocated buffer is returned, or | | NULL in case no memory is available --------------------+------------------+--------------------------------------- -b_alloc_fast | buffer *buf | allocates a buffer and assigns it to - | ret: buffer * | *buf. If no memory is available, (1) - | | is assigned instead with a zero size. - | | No control is made to check if *buf - | | already pointed to another buffer. The - | | allocated buffer is returned, or NULL - | | in case no memory is available. The - | | difference with b_alloc() is that this - | | function only picks from the pool and - | | never calls malloc(), so it can fail - | | even if some memory is available ---------------------+------------------+--------------------------------------- __b_free | buffer *buf | releases which must be allocated | ret: void | and marks it empty --------------------+------------------+--------------------------------------- diff --git a/include/haproxy/dynbuf.h b/include/haproxy/dynbuf.h index 6835cd6c4..2a9051546 100644 --- a/include/haproxy/dynbuf.h +++ b/include/haproxy/dynbuf.h @@ -79,27 +79,6 @@ static inline struct buffer *b_alloc(struct buffer *buf) return buf; } -/* Allocates a buffer and assigns it to *buf. If no memory is available, - * ((char *)1) is assigned instead with a zero size. No control is made to - * check if *buf already pointed to another buffer. The allocated buffer is - * returned, or NULL in case no memory is available. The difference with - * b_alloc() is that this function only picks from the pool and never calls - * malloc(), so it can fail even if some memory is available. - */ -static inline struct buffer *b_alloc_fast(struct buffer *buf) -{ - char *area; - - *buf = BUF_WANTED; - area = pool_get_first(pool_head_buffer); - if (unlikely(!area)) - return NULL; - - buf->area = area; - buf->size = pool_head_buffer->size; - return buf; -} - /* Releases buffer (no check of emptiness). The buffer's head is marked * empty. */