summaryrefslogtreecommitdiffstats
path: root/src/expr/bitwise.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/bitwise.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/bitwise.c')
-rw-r--r--src/expr/bitwise.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/expr/bitwise.c b/src/expr/bitwise.c
index 1d46a97..d0c7827 100644
--- a/src/expr/bitwise.c
+++ b/src/expr/bitwise.c
@@ -210,10 +210,10 @@ nftnl_expr_bitwise_parse(struct nftnl_expr *e, struct nlattr *attr)
}
static int
-nftnl_expr_bitwise_snprintf_bool(char *buf, size_t size,
+nftnl_expr_bitwise_snprintf_bool(char *buf, size_t remain,
const struct nftnl_expr_bitwise *bitwise)
{
- int remain = size, offset = 0, ret;
+ int offset = 0, ret;
ret = snprintf(buf, remain, "reg %u = ( reg %u & ",
bitwise->dreg, bitwise->sreg);
@@ -234,9 +234,9 @@ nftnl_expr_bitwise_snprintf_bool(char *buf, size_t size,
}
static int
-nftnl_expr_bitwise_snprintf_shift(char *buf, size_t size, const char *op,
+nftnl_expr_bitwise_snprintf_shift(char *buf, size_t remain, const char *op,
const struct nftnl_expr_bitwise *bitwise)
-{ int remain = size, offset = 0, ret;
+{ int offset = 0, ret;
ret = snprintf(buf, remain, "reg %u = ( reg %u %s ",
bitwise->dreg, bitwise->sreg, op);