]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: tools: make csv_enc_append() always start at the first byte of the chunk
authorWilly Tarreau <w@1wt.eu>
Fri, 8 Jan 2016 09:04:08 +0000 (10:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 8 Jan 2016 09:08:15 +0000 (10:08 +0100)
commitb631c291c9211a1f0446d4b7fd29a3ebaa154c96
treed4d2c322a5158a44d5b3333ed6eceac4bb1e98ce
parent898529b4a8ed14b61af14785d27f293b79653627
MINOR: tools: make csv_enc_append() always start at the first byte of the chunk

csv_enc_append() returns a pointer to the beginning of the encoded
string, which makes it convenient to use in printf(). However it's not
convenient for use in chunks as it may leave an unused byte at the
beginning depending on the automatic quoting. Let's modify it to work
in two passes. First it looks for a character that requires escaping
using strpbrk(), and second it encodes the string. This way it
guarantees to always start at the first available byte of the chunk.
Additionally it made the code quite simpler.
src/standard.c