diff options
author | Phil Sutter <phil@nwl.cc> | 2021-03-09 11:26:47 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-03-15 12:23:20 +0100 |
commit | 960c8e6174374ee113b290c304365bf02ed346d6 (patch) | |
tree | 3c5b27821e29409822920e6113e1c3364ac5b4e9 /src/expr/dynset.c | |
parent | 4f6e671b462180ba9af12bd30211811b5fca8cb1 (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/dynset.c')
-rw-r--r-- | src/expr/dynset.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/expr/dynset.c b/src/expr/dynset.c index 2ddf69a..85d64bb 100644 --- a/src/expr/dynset.c +++ b/src/expr/dynset.c @@ -308,12 +308,12 @@ static const char *op2str(enum nft_dynset_ops op) } static int -nftnl_expr_dynset_snprintf(char *buf, size_t size, +nftnl_expr_dynset_snprintf(char *buf, size_t remain, uint32_t flags, const struct nftnl_expr *e) { struct nftnl_expr_dynset *dynset = nftnl_expr_data(e); struct nftnl_expr *expr; - int remain = size, offset = 0, ret; + int offset = 0, ret; ret = snprintf(buf, remain, "%s reg_key %u set %s ", op2str(dynset->op), dynset->sreg_key, dynset->set_name); |