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.
This commit is contained in:
Thierry FOURNIER 2015-08-19 09:02:36 +02:00 committed by Willy Tarreau
parent 2046c46468
commit 5cc18d46f3
2 changed files with 4 additions and 8 deletions

View File

@ -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;
}

View File

@ -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;
}