diff options
author | Patrick McHardy <kaber@trash.net> | 2014-12-13 07:50:35 +0000 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2014-12-16 18:20:54 +0100 |
commit | 25b19818c46d6fea81f3b951223f4ec7fa86ed55 (patch) | |
tree | 70246dcce7760c6f9c8aa066ca051f05f93e73ea /src/evaluate.c | |
parent | 8a5697cf51937b54fc9a2c1f0d22f19dafe4d61e (diff) |
datatype: change concat_type_alloc() to construct type from id
The kernel only stored the id so we need to be able to reconstruct
the datatype from the id only.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/evaluate.c')
-rw-r--r-- | src/evaluate.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/evaluate.c b/src/evaluate.c index 9cb2376a..8f0acf72 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -604,11 +604,11 @@ static int list_member_evaluate(struct eval_ctx *ctx, struct expr **expr) static int expr_evaluate_concat(struct eval_ctx *ctx, struct expr **expr) { const struct datatype *dtype = ctx->ectx.dtype, *tmp; - unsigned int type = dtype ? dtype->type : 0; + uint32_t type = dtype ? dtype->type : 0, ntype = 0; int off = dtype ? dtype->subtypes : 0; unsigned int flags = EXPR_F_CONSTANT | EXPR_F_SINGLETON; struct expr *i, *next; - unsigned int n, len = 0; + unsigned int n; n = 1; list_for_each_entry_safe(i, next, &(*expr)->expressions, list) { @@ -624,13 +624,14 @@ static int expr_evaluate_concat(struct eval_ctx *ctx, struct expr **expr) return -1; flags &= i->flags; - len += i->len; + ntype <<= TYPE_BITS; + ntype |= i->dtype->type; n++; } (*expr)->flags |= flags; - (*expr)->dtype = concat_type_alloc(*expr); - (*expr)->len = len; + (*expr)->dtype = concat_type_alloc(ntype); + (*expr)->len = (*expr)->dtype->size; if (off > 0) return expr_error(ctx->msgs, *expr, |