]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
expression: Differentiate expr among anonymous structures in struct expr
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Thu, 2 Aug 2012 00:31:35 +0000 (00:31 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 3 Aug 2012 09:38:56 +0000 (11:38 +0200)
This fixes compilation with gcc-4.7

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/expression.h
src/evaluate.c
src/expression.c
src/netlink_delinearize.c
src/netlink_linearize.c
src/segtree.c

index 88042846855a11e7a2180593824ba08764c20b86..7074bbe7650a8235792326afc29327ed0ddce56c 100644 (file)
@@ -195,7 +195,7 @@ struct expr {
                };
                struct {
                        /* EXPR_PREFIX */
-                       struct expr             *expr;
+                       struct expr             *prefix;
                        unsigned int            prefix_len;
                };
                struct {
@@ -219,7 +219,7 @@ struct expr {
                };
                struct {
                        /* EXPR_MAP */
-                       struct expr             *expr;
+                       struct expr             *map;
                        struct expr             *mappings;
                };
 
index a371c24a36cf7acf186c5513cbf57b4d557fd9d4..da3a0d4e284e86c05a932162cac56b51e42e130e 100644 (file)
@@ -291,9 +291,9 @@ static int expr_evaluate_prefix(struct eval_ctx *ctx, struct expr **expr)
 {
        struct expr *prefix = *expr, *base, *and, *mask;
 
-       if (expr_evaluate(ctx, &prefix->expr) < 0)
+       if (expr_evaluate(ctx, &prefix->prefix) < 0)
                return -1;
-       base = prefix->expr;
+       base = prefix->prefix;
 
        if (!expr_is_constant(base))
                return expr_error(ctx, prefix,
@@ -317,10 +317,10 @@ static int expr_evaluate_prefix(struct eval_ctx *ctx, struct expr **expr)
        mpz_prefixmask(mask->value, base->len, prefix->prefix_len);
        and  = binop_expr_alloc(&prefix->location, OP_AND, base, mask);
 
-       prefix->expr = and;
-       if (expr_evaluate(ctx, &prefix->expr) < 0)
+       prefix->prefix = and;
+       if (expr_evaluate(ctx, &prefix->prefix) < 0)
                return -1;
-       base = prefix->expr;
+       base = prefix->prefix;
        assert(expr_is_constant(base));
 
        prefix->dtype     = base->dtype;
@@ -656,10 +656,10 @@ static int expr_evaluate_map(struct eval_ctx *ctx, struct expr **expr)
        struct expr_ctx ectx = ctx->ectx;
        struct expr *map = *expr, *mappings;
 
-       if (expr_evaluate(ctx, &map->expr) < 0)
+       if (expr_evaluate(ctx, &map->map) < 0)
                return -1;
-       if (expr_is_constant(map->expr))
-               return expr_error(ctx, map->expr,
+       if (expr_is_constant(map->map))
+               return expr_error(ctx, map->map,
                                  "Map expression can not be constant");
 
        mappings = map->mappings;
@@ -695,7 +695,7 @@ static int expr_evaluate_map(struct eval_ctx *ctx, struct expr **expr)
 
        /* Data for range lookups needs to be in big endian order */
        if (map->mappings->set_flags & SET_F_INTERVAL &&
-           byteorder_conversion(ctx, &map->expr, BYTEORDER_BIG_ENDIAN) < 0)
+           byteorder_conversion(ctx, &map->map, BYTEORDER_BIG_ENDIAN) < 0)
                return -1;
 
        return 0;
@@ -895,7 +895,7 @@ static int expr_evaluate_relational(struct eval_ctx *ctx, struct expr **expr)
                case EXPR_RANGE:
                        goto range;
                case EXPR_PREFIX:
-                       if (byteorder_conversion(ctx, &right->expr, left->byteorder) < 0)
+                       if (byteorder_conversion(ctx, &right->prefix, left->byteorder) < 0)
                                return -1;
                        break;
                case EXPR_VALUE:
index dffe7a8beaa54eca6fc7f74972bf92ac4a5cfe2c..5dbc327c703ff1b0aee1cbcb37870f013cee8f3c 100644 (file)
@@ -302,7 +302,7 @@ struct expr *constant_expr_splice(struct expr *expr, unsigned int len)
 
 static void prefix_expr_print(const struct expr *expr)
 {
-       expr_print(expr->expr);
+       expr_print(expr->prefix);
        printf("/%u", expr->prefix_len);
 }
 
@@ -310,18 +310,18 @@ static void prefix_expr_set_type(const struct expr *expr,
                                 const struct datatype *type,
                                 enum byteorder byteorder)
 {
-       expr_set_type(expr->expr, type, byteorder);
+       expr_set_type(expr->prefix, type, byteorder);
 }
 
 static void prefix_expr_clone(struct expr *new, const struct expr *expr)
 {
-       new->expr       = expr_clone(expr->expr);
+       new->prefix     = expr_clone(expr->prefix);
        new->prefix_len = expr->prefix_len;
 }
 
 static void prefix_expr_destroy(struct expr *expr)
 {
-       expr_free(expr->expr);
+       expr_free(expr->prefix);
 }
 
 static const struct expr_ops prefix_expr_ops = {
@@ -340,7 +340,7 @@ struct expr *prefix_expr_alloc(const struct location *loc,
 
        prefix = expr_alloc(loc, &prefix_expr_ops, &invalid_type,
                            BYTEORDER_INVALID, 0);
-       prefix->expr       = expr;
+       prefix->prefix     = expr;
        prefix->prefix_len = prefix_len;
        return prefix;
 }
@@ -374,7 +374,7 @@ static void unary_expr_print(const struct expr *expr)
 
 static void unary_expr_clone(struct expr *new, const struct expr *expr)
 {
-       new->arg = expr_clone(expr->expr);
+       new->arg = expr_clone(expr->arg);
 }
 
 static void unary_expr_destroy(struct expr *expr)
@@ -680,20 +680,20 @@ struct expr *mapping_expr_alloc(const struct location *loc,
 
 static void map_expr_print(const struct expr *expr)
 {
-       expr_print(expr->expr);
+       expr_print(expr->map);
        printf(" map ");
        expr_print(expr->mappings);
 }
 
 static void map_expr_clone(struct expr *new, const struct expr *expr)
 {
-       new->expr     = expr_clone(expr->expr);
+       new->map      = expr_clone(expr->map);
        new->mappings = expr_clone(expr->mappings);
 }
 
 static void map_expr_destroy(struct expr *expr)
 {
-       expr_free(expr->expr);
+       expr_free(expr->map);
        expr_free(expr->mappings);
 }
 
@@ -711,7 +711,7 @@ struct expr *map_expr_alloc(const struct location *loc, struct expr *arg,
        struct expr *expr;
 
        expr = expr_alloc(loc, &map_expr_ops, &invalid_type, BYTEORDER_INVALID, 0);
-       expr->expr     = arg;
+       expr->map      = arg;
        expr->mappings = mappings;
        return expr;
 }
index d75df215cf97d6ad5d23e54916f9da9c7807b5b2..1963966cbaaf6155c2369eebd49ff035a77094e2 100644 (file)
@@ -533,7 +533,7 @@ static void expr_postprocess(struct rule_pp_ctx *ctx,
 
        switch (expr->ops->type) {
        case EXPR_MAP:
-               expr_postprocess(ctx, stmt, &expr->expr);
+               expr_postprocess(ctx, stmt, &expr->map);
                expr_postprocess(ctx, stmt, &expr->mappings);
                break;
        case EXPR_MAPPING:
index a3841fb9e3e2b4f02f034263f9eac62c44653d9c..18315bdf708b69011a8c6a45a9476b191593ca5d 100644 (file)
@@ -114,7 +114,7 @@ static void netlink_gen_map(struct netlink_linearize_ctx *ctx,
        else
                sreg = dreg;
 
-       netlink_gen_expr(ctx, expr->expr, sreg);
+       netlink_gen_expr(ctx, expr->map, sreg);
 
        nle = alloc_nft_expr(nfnl_nft_lookup_init);
        nfnl_nft_lookup_set_sreg(nle, sreg);
index 9e59bb6e01c3bf277962ac23df71c7d4a7c527bd..fb404a431f7db5dd125752ffa5eb60a041c6eeae 100644 (file)
@@ -240,7 +240,7 @@ static void range_low(mpz_t rop, struct expr *expr)
        case EXPR_VALUE:
                return mpz_set(rop, expr->value);
        case EXPR_PREFIX:
-               return range_low(rop, expr->expr);
+               return range_low(rop, expr->prefix);
        case EXPR_RANGE:
                return range_low(rop, expr->left);
        case EXPR_MAPPING:
@@ -258,7 +258,7 @@ static void range_high(mpz_t rop, const struct expr *expr)
        case EXPR_VALUE:
                return mpz_set(rop, expr->value);
        case EXPR_PREFIX:
-               range_low(rop, expr->expr);
+               range_low(rop, expr->prefix);
                mpz_init_bitmask(tmp, expr->len - expr->prefix_len);
                mpz_add(rop, rop, tmp);
                mpz_clear(tmp);