Move the code for printing boolean expressions into a separate function. Another function will be added for shifts later. Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx> --- src/expr/bitwise.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/expr/bitwise.c b/src/expr/bitwise.c index 489ee8420c44..472bf59f7ad5 100644 --- a/src/expr/bitwise.c +++ b/src/expr/bitwise.c @@ -174,10 +174,10 @@ nftnl_expr_bitwise_parse(struct nftnl_expr *e, struct nlattr *attr) return ret; } -static int nftnl_expr_bitwise_snprintf_default(char *buf, size_t size, - const struct nftnl_expr *e) +static int +nftnl_expr_bitwise_snprintf_bool(char *buf, size_t size, + const struct nftnl_expr_bitwise *bitwise) { - struct nftnl_expr_bitwise *bitwise = nftnl_expr_data(e); int remain = size, offset = 0, ret; ret = snprintf(buf, remain, "reg %u = (reg=%u & ", @@ -198,6 +198,14 @@ static int nftnl_expr_bitwise_snprintf_default(char *buf, size_t size, return offset; } +static int nftnl_expr_bitwise_snprintf_default(char *buf, size_t size, + const struct nftnl_expr *e) +{ + struct nftnl_expr_bitwise *bitwise = nftnl_expr_data(e); + + return nftnl_expr_bitwise_snprintf_bool(buf, size, bitwise); +} + static int nftnl_expr_bitwise_snprintf(char *buf, size_t size, uint32_t type, uint32_t flags, const struct nftnl_expr *e) -- 2.24.1