MINOR: sample: provide smp_is_rw() and smp_make_rw()
authorWilly Tarreau <w@1wt.eu>
Tue, 9 Aug 2016 09:49:20 +0000 (11:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 9 Aug 2016 12:30:57 +0000 (14:30 +0200)
commit77128f585ce682ebc14f063f4b91c8cdecf4e4b8
tree43b0b2083e653a6812e0e5c57cc495fe6c50c31f
parent2c594794dda6b744299dbe322576eb5ef088033c
MINOR: sample: provide smp_is_rw() and smp_make_rw()

At some places, smp_dup() is inappropriately called to ensure a modification
is possible while in fact we only need to ensure the sample may be modified
in place. Let's provide smp_is_rw() to check for this capability and
smp_make_rw() to perform the smp_dup() when it is not the case.

Note that smp_is_rw() will also try to add the trailing zero on strings when
needed if possible, to avoid a useless duplication.
include/proto/sample.h