]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: buffer: replace b_drop() with b_free()
authorWilly Tarreau <w@1wt.eu>
Thu, 8 Aug 2019 06:06:27 +0000 (08:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 8 Aug 2019 06:07:45 +0000 (08:07 +0200)
Since last commit there's no point anymore in having two variants of the
same function, let's switch to b_free() only. __b_drop() was renamed to
__b_free() for obvious consistency reasons.

doc/internals/buffer-api.txt
include/common/buffer.h
src/stream.c

index abb5e9f769e27675f78113948d60218c57b7722a..6d192c19d403f9470765c0e0ac79cb711e034d8d 100644 (file)
@@ -567,10 +567,7 @@ b_alloc_fast        | buffer *buf      | allocates a buffer and assigns it to
                     |                  | never calls malloc(), so it can fail
                     |                  | even if some memory is available
 --------------------+------------------+---------------------------------------
-__b_drop            | buffer *buf      | releases <buf> which must be allocated
-                    | ret: void        | and marks it empty
---------------------+------------------+---------------------------------------
-b_drop              | buffer *buf      | releases <buf> only if it is allocated
+__b_free            | buffer *buf      | releases <buf> which must be allocated
                     | ret: void        | and marks it empty
 --------------------+------------------+---------------------------------------
 b_free              | buffer *buf      | releases <buf> only if it is allocated
index 34a3e95d2d613b088efd518eb73d2501f8f8c0e3..0d44ec8d5d28318d09cd0e285d3ef1437a9c0e1c 100644 (file)
@@ -112,7 +112,7 @@ static inline struct buffer *b_alloc_fast(struct buffer *buf)
 /* Releases buffer <buf> (no check of emptiness). The buffer's head is marked
  * empty.
  */
-static inline void __b_drop(struct buffer *buf)
+static inline void __b_free(struct buffer *buf)
 {
        char *area = buf->area;
 
@@ -124,17 +124,11 @@ static inline void __b_drop(struct buffer *buf)
        pool_free(pool_head_buffer, area);
 }
 
-/* Releases buffer <buf> if allocated, and marks it empty. */
-static inline void b_drop(struct buffer *buf)
-{
-       if (buf->size)
-               __b_drop(buf);
-}
-
 /* Releases buffer <buf> if allocated, and marks it empty. */
 static inline void b_free(struct buffer *buf)
 {
-       b_drop(buf);
+       if (buf->size)
+               __b_free(buf);
 }
 
 /* Ensures that <buf> is allocated. If an allocation is needed, it ensures that
index a135dcb248aa7b6d901322b3e244f41a51ba6c20..913de6389770235fa1db81898f8e7113819a0afd 100644 (file)
@@ -404,8 +404,8 @@ static void stream_free(struct stream *s)
                HA_SPIN_UNLOCK(BUF_WQ_LOCK, &buffer_wq_lock);
        }
        if (s->req.buf.size || s->res.buf.size) {
-               b_drop(&s->req.buf);
-               b_drop(&s->res.buf);
+               b_free(&s->req.buf);
+               b_free(&s->res.buf);
                offer_buffers(NULL, tasks_run_queue);
        }