summaryrefslogtreecommitdiffstats
path: root/src/expr/dup.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2021-03-09 11:26:47 +0100
committerPhil Sutter <phil@nwl.cc>2021-03-15 12:23:20 +0100
commit960c8e6174374ee113b290c304365bf02ed346d6 (patch)
tree3c5b27821e29409822920e6113e1c3364ac5b4e9 /src/expr/dup.c
parent4f6e671b462180ba9af12bd30211811b5fca8cb1 (diff)
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 <phil@nwl.cc>
Diffstat (limited to 'src/expr/dup.c')
-rw-r--r--src/expr/dup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/expr/dup.c b/src/expr/dup.c
index 3eb560a..f041b55 100644
--- a/src/expr/dup.c
+++ b/src/expr/dup.c
@@ -111,11 +111,11 @@ static int nftnl_expr_dup_parse(struct nftnl_expr *e, struct nlattr *attr)
return ret;
}
-static int nftnl_expr_dup_snprintf(char *buf, size_t len,
+static int nftnl_expr_dup_snprintf(char *buf, size_t remain,
uint32_t flags, const struct nftnl_expr *e)
{
- int remain = len, offset = 0, ret;
struct nftnl_expr_dup *dup = nftnl_expr_data(e);
+ int offset = 0, ret;
if (e->flags & (1 << NFTNL_EXPR_DUP_SREG_ADDR)) {
ret = snprintf(buf + offset, remain, "sreg_addr %u ", dup->sreg_addr);