From 68e76238749fb238bf92e7dc8903fed15a86aa1b Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Fri, 8 Feb 2019 17:02:19 +0100 Subject: src: expr: add and use expr_name helper Currently callers use expr->ops->name, but follouwp patch will remove the ops pointer from struct expr. So add this helper and use it everywhere. Signed-off-by: Florian Westphal Acked-by: Pablo Neira Ayuso --- src/expression.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/expression.c') diff --git a/src/expression.c b/src/expression.c index 62a6f890..37b106f8 100644 --- a/src/expression.c +++ b/src/expression.c @@ -87,6 +87,11 @@ bool expr_cmp(const struct expr *e1, const struct expr *e2) return e1->ops->cmp(e1, e2); } +const char *expr_name(const struct expr *e) +{ + return e->ops->name; +} + void expr_describe(const struct expr *expr, struct output_ctx *octx) { const struct datatype *dtype = expr->dtype; @@ -1106,7 +1111,7 @@ void range_expr_value_low(mpz_t rop, const struct expr *expr) case EXPR_SET_ELEM: return range_expr_value_low(rop, expr->key); default: - BUG("invalid range expression type %s\n", expr->ops->name); + BUG("invalid range expression type %s\n", expr_name(expr)); } } @@ -1130,6 +1135,6 @@ void range_expr_value_high(mpz_t rop, const struct expr *expr) case EXPR_SET_ELEM: return range_expr_value_high(rop, expr->key); default: - BUG("invalid range expression type %s\n", expr->ops->name); + BUG("invalid range expression type %s\n", expr_name(expr)); } } -- cgit v1.2.3