From: Thierry FOURNIER Date: Wed, 19 Aug 2015 07:02:36 +0000 (+0200) Subject: MINOR: samples: data assignation simplification X-Git-Tag: v1.6-dev4~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cc18d46f334e15e2d0d62d4be9e06b27e928d7a;p=thirdparty%2Fhaproxy.git MINOR: samples: data assignation simplification With the difference between the "struct sample" data and the "struct sample_storage" data, it was not possible to write data = data, and we did a memcpy. This patch remove some of these memcpy. --- diff --git a/src/map.c b/src/map.c index 73e057ed69..577d4187cc 100644 --- a/src/map.c +++ b/src/map.c @@ -161,9 +161,8 @@ static int sample_conv_map(const struct arg *arg_p, struct sample *smp, void *pr if (pat) { /* Copy sample. */ if (pat->data) { - smp->data.type = pat->data->type; + smp->data = *pat->data; smp->flags |= SMP_F_CONST; - memcpy(&smp->data.u, &pat->data->u, sizeof(smp->data.u)); return 1; } diff --git a/src/vars.c b/src/vars.c index ed30846bf5..3ad0c16947 100644 --- a/src/vars.c +++ b/src/vars.c @@ -249,9 +249,8 @@ static int smp_fetch_var(const struct arg *args, struct sample *smp, const char return 0; /* Copy sample. */ - smp->data.type = var->data.type; + smp->data = var->data; smp->flags |= SMP_F_CONST; - memcpy(&smp->data.u, &var->data.u, sizeof(smp->data.u)); return 1; } @@ -442,9 +441,8 @@ int vars_get_by_name(const char *name, size_t len, struct stream *strm, struct s return 0; /* Copy sample. */ - smp->data.type = var->data.type; + smp->data = var->data; smp->flags = SMP_F_CONST; - memcpy(&smp->data.u, &var->data.u, sizeof(smp->data.u)); return 1; } @@ -476,9 +474,8 @@ int vars_get_by_desc(const struct var_desc *var_desc, struct stream *strm, struc return 0; /* Copy sample. */ - smp->data.type = var->data.type; + smp->data = var->data; smp->flags = SMP_F_CONST; - memcpy(&smp->data.u, &var->data.u, sizeof(smp->data.u)); return 1; }