From: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> Fetch expression operation from the expression type. Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> Signed-off-by: Florian Westphal <fw@xxxxxxxxx> --- include/expression.h | 1 + src/expression.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/expression.h b/include/expression.h index 717b67550381..d502fc2a8611 100644 --- a/include/expression.h +++ b/include/expression.h @@ -169,6 +169,7 @@ struct expr_ops { }; const struct expr_ops *expr_ops(const struct expr *e); +const struct expr_ops *expr_ops_by_type(enum expr_types etype); /** * enum expr_flags diff --git a/src/expression.c b/src/expression.c index 6fa2f1dd9b12..a7bbde7eec1a 100644 --- a/src/expression.c +++ b/src/expression.c @@ -1222,3 +1222,15 @@ const struct expr_ops *expr_ops(const struct expr *e) BUG("Unknown expression type %d\n", e->etype); } + +const struct expr_ops *expr_ops_by_type(enum expr_types etype) +{ + switch (etype) { + case EXPR_PAYLOAD: + return &payload_expr_ops; + default: + break; + } + + BUG("Unknown expression type %d\n", etype); +} -- 2.24.1