]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: dynbuf: make b_alloc() always check if the buffer is allocated
authorWilly Tarreau <w@1wt.eu>
Mon, 22 Mar 2021 15:10:22 +0000 (16:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 22 Mar 2021 15:14:45 +0000 (16:14 +0100)
commit766b6cf20687477e4bd4d20835b8091906149168
tree5c6cfc68596e7bc614c0165bb1382cc179064be5
parentb7bf53e15004204e456fa552ebd82ba4245a01ff
MINOR: dynbuf: make b_alloc() always check if the buffer is allocated

Right now there is a discrepancy beteween b_alloc() and b_allow_margin():
the former forcefully overwrites the target pointer while the latter tests
it and returns it as-is if already allocated.

As a matter of fact, all callers of b_alloc() either preliminary test the
buffer, or assume it's already null.

Let's remove this pain and make the function test the buffer's allocation
before doing it again, and match call places' expectations.
doc/internals/buffer-api.txt
include/haproxy/dynbuf.h