From 960c8e6174374ee113b290c304365bf02ed346d6 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 9 Mar 2021 11:26:47 +0100 Subject: Drop pointless local variable in snprintf callbacks A common idiom among snprintf callbacks was to copy the unsigned parameter 'size' (or 'len') into a signed variable for further use. Though since snprintf() itself casts it to unsigned and SNPRINTF_BUFFER_SIZE() does not allow it to become negative, this is not needed. Drop the local variable and rename the parameter accordingly. Signed-off-by: Phil Sutter --- src/expr/byteorder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/expr/byteorder.c') diff --git a/src/expr/byteorder.c b/src/expr/byteorder.c index 9718b8f..d299745 100644 --- a/src/expr/byteorder.c +++ b/src/expr/byteorder.c @@ -198,11 +198,11 @@ static inline int nftnl_str2ntoh(const char *op) } static int -nftnl_expr_byteorder_snprintf(char *buf, size_t size, +nftnl_expr_byteorder_snprintf(char *buf, size_t remain, uint32_t flags, const struct nftnl_expr *e) { struct nftnl_expr_byteorder *byteorder = nftnl_expr_data(e); - int remain = size, offset = 0, ret; + int offset = 0, ret; ret = snprintf(buf, remain, "reg %u = %s(reg %u, %u, %u) ", byteorder->dreg, bo2str(byteorder->op), -- cgit v1.2.3