]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: chunks: add chunk_strcat() and chunk_newstr()
authorWilly Tarreau <w@1wt.eu>
Mon, 4 Jan 2016 19:13:55 +0000 (20:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 6 Jan 2016 12:53:37 +0000 (13:53 +0100)
commit601360b41d4caffd098edae17145f7d640fab63a
treec6c051ff6145d0c52b59ebf9822e9c70c1db86d4
parent0b6044fa241386d21994e496bc9e29851b5863dc
MINOR: chunks: add chunk_strcat() and chunk_newstr()

These two new functions will make it easier to manipulate small strings
from within functions, because at many places, multiple short strings
are needed which do not deserve a malloc() nor a free(), and alloca()
is often discouraged. Since we already have trash chunks, it's convenient
to be able to allocate substrings from a chunk and use them later since
our functions already perform all the length checks. chunk_newstr() adds
a trailing zero at the end of a chunk and returns the pointer to the next
character, which can be used as an independant string. chunk_strcat()
does what it says.
include/common/chunk.h