From f4ad4d3879cead150e86c279ac8e4770e4b167b1 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 9 Mar 2021 10:40:16 +0100 Subject: expr: Check output type once and for all There is but a single supported output type left, so check it in expr.c and drop all the single option switch statements in individual expressions. Since the parameter is now unused (and to ensure code correctness), drop 'type' parameter from struct expr_ops' snprintf callback. Signed-off-by: Phil Sutter --- src/expr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/expr.c') diff --git a/src/expr.c b/src/expr.c index 8e0bce2..01c55cf 100644 --- a/src/expr.c +++ b/src/expr.c @@ -279,10 +279,10 @@ int nftnl_expr_snprintf(char *buf, size_t size, const struct nftnl_expr *expr, if (size) buf[0] = '\0'; - if (!expr->ops->snprintf) + if (!expr->ops->snprintf || type != NFTNL_OUTPUT_DEFAULT) return 0; - ret = expr->ops->snprintf(buf + offset, remain, type, flags, expr); + ret = expr->ops->snprintf(buf + offset, remain, flags, expr); SNPRINTF_BUFFER_SIZE(ret, remain, offset); return offset; -- cgit v1.2.3