summaryrefslogtreecommitdiffstats
path: root/src/gen.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/gen.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/gen.c')
-rw-r--r--src/gen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gen.c b/src/gen.c
index f2ac2ba..362132e 100644
--- a/src/gen.c
+++ b/src/gen.c
@@ -156,15 +156,15 @@ int nftnl_gen_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_gen *gen)
return 0;
}
-static int nftnl_gen_cmd_snprintf(char *buf, size_t size,
+static int nftnl_gen_cmd_snprintf(char *buf, size_t remain,
const struct nftnl_gen *gen, uint32_t cmd,
uint32_t type, uint32_t flags)
{
- int ret, remain = size, offset = 0;
+ int ret, offset = 0;
switch(type) {
case NFTNL_OUTPUT_DEFAULT:
- ret = snprintf(buf, size, "ruleset generation ID %u", gen->id);
+ ret = snprintf(buf, remain, "ruleset generation ID %u", gen->id);
SNPRINTF_BUFFER_SIZE(ret, remain, offset);
break;
default: