From 72931553828af0ce85f0562b9ff8ec7f4d28e050 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Fri, 8 Feb 2019 17:02:22 +0100 Subject: src: expr: add expression etype Temporary kludge to remove all the expr->ops->type == ... patterns. Followup patch will remove expr->ops, and make expr_ops() lookup the correct expr_ops struct instead to reduce struct expr size. Signed-off-by: Florian Westphal --- src/parser_json.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/parser_json.c') diff --git a/src/parser_json.c b/src/parser_json.c index 6268ad5b..3a9a3798 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -993,7 +993,7 @@ static struct expr *json_parse_concat_expr(struct json_ctx *ctx, expr = tmp; continue; } - if (expr->ops->type != EXPR_CONCAT) { + if (expr->etype != EXPR_CONCAT) { struct expr *concat; concat = concat_expr_alloc(int_loc); @@ -1093,7 +1093,7 @@ static struct expr *json_parse_set_expr(struct json_ctx *ctx, if (!expr) return NULL; - if (expr->ops->type == EXPR_SYMBOL && + if (expr->etype == EXPR_SYMBOL && expr->symtype == SYMBOL_SET) return expr; @@ -1116,7 +1116,7 @@ static struct expr *json_parse_set_expr(struct json_ctx *ctx, expr_free(set_expr); return NULL; } - if (expr->ops->type != EXPR_SET_ELEM) + if (expr->etype != EXPR_SET_ELEM) expr = set_elem_expr_alloc(int_loc, expr); expr2 = json_parse_set_rhs_expr(ctx, jright); @@ -1137,7 +1137,7 @@ static struct expr *json_parse_set_expr(struct json_ctx *ctx, return NULL; } - if (expr->ops->type != EXPR_SET_ELEM) + if (expr->etype != EXPR_SET_ELEM) expr = set_elem_expr_alloc(int_loc, expr); } @@ -1406,7 +1406,7 @@ static struct expr *json_parse_set_elem_expr_stmt(struct json_ctx *ctx, json_t * { struct expr *expr = json_parse_flagged_expr(ctx, CTX_F_SES, root); - if (expr && expr->ops->type != EXPR_SET_ELEM) + if (expr && expr->etype != EXPR_SET_ELEM) expr = set_elem_expr_alloc(int_loc, expr); return expr; @@ -1559,7 +1559,7 @@ static struct stmt *json_parse_mangle_stmt(struct json_ctx *ctx, return NULL; } - switch (key->ops->type) { + switch (key->etype) { case EXPR_EXTHDR: return exthdr_stmt_alloc(int_loc, key, value); case EXPR_PAYLOAD: -- cgit v1.2.3