mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: sample: use smp_make_rw() in upper/lower converters
There's no point in always duplicating the sample, just ensure it's writable, as was done prior to the smp_dup() change. This should be backported to 1.6 to avoid a performance regression caused by this change (about 30% more time for upper/lower due to the copy).
This commit is contained in:
parent
f65c6c0456
commit
f0645dce4f
10
src/sample.c
10
src/sample.c
@ -1474,10 +1474,7 @@ static int sample_conv_str2lower(const struct arg *arg_p, struct sample *smp, vo
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!smp_dup(smp))
|
if (!smp_make_rw(smp))
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!smp->data.u.str.size)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < smp->data.u.str.len; i++) {
|
for (i = 0; i < smp->data.u.str.len; i++) {
|
||||||
@ -1491,10 +1488,7 @@ static int sample_conv_str2upper(const struct arg *arg_p, struct sample *smp, vo
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!smp_dup(smp))
|
if (!smp_make_rw(smp))
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!smp->data.u.str.size)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < smp->data.u.str.len; i++) {
|
for (i = 0; i < smp->data.u.str.len; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user