]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: log: write raw strings using lf_rawtext()
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 27 Mar 2024 09:28:59 +0000 (10:28 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Fri, 26 Apr 2024 16:39:31 +0000 (18:39 +0200)
commit3a3bdf1c7664ad221d78fad78bd6b8cf8a615e99
treed7de276cd9fa1db1ff0145910c21c532df9a3053
parent0d1e99c0864c937be079dc884aa8f53694062e1e
MEDIUM: log: write raw strings using lf_rawtext()

Make use of the previous commit to print strings that should not be
modified.

For instance, when +X option is provided, we have to print numerical
values in ASCII HEX form. For that, we used snprintf() to output the
result to the log output buffer directly, but now we build the string in
a temporary buffer of fixed-size and then print it using lf_rawtext()
which will take care of encoding options.

Because of this patch, we add a little overhead because we first generate
the text into a temporary variable and then use lf_rawtext() to print it.
Thus we have a double-copy, and this could have some performance
implications that were not yet evaluated. Due to the small number of bytes
that can end up being copied twice, we could be lucky and have no visible
performance impact, but if we happen to see a significant impact, it could
be useful to add a passthrough mechanism (to keep historical behavior)
when no encoding is involved.
src/log.c