]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: ist: add functions to copy/uppercase/lowercase into a buffer or string
authorWilly Tarreau <w@1wt.eu>
Fri, 7 Dec 2018 07:35:07 +0000 (08:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 7 Dec 2018 12:25:59 +0000 (13:25 +0100)
commit3f2d696d7261b9d88aba37ce4e45446b4083b9ae
treed6469054f63618dbd8343e5c9206d769a532eb2d
parentce7fad5232aeb8d644f1359404f38fbe4974a305
MINOR: ist: add functions to copy/uppercase/lowercase into a buffer or string

The ist functions were missing functions to copy an IST into a target
buffer, making some code have to resort to memcpy(), which tends to be
overkill for small strings, that the compiler cannot guess. In addition
sometimes there is a need to turn a string to lower or upper case so it
had to be overwritten after the operation.

This patch adds 6 functions to copy an ist to a buffer, as binary or as a
string (i.e. a zero is or is not appended), and optionally to apply a
lower case or upper case transformation on the fly.

A number of tests were performed to optimize the processing for small
strings. The loops are marked unlikely to dissuade the compilers from
over-optimizing them and switching to SIMD instructions. The lower case
or upper case transformations used to rely on external functions for
each character and to crappify the code due to clobbered registers,
which is not acceptable when we know that only a certain class of chars
has to be transformed, so the test was open-coded.
include/common/ist.h