From 676ea569bbe5abf750d9ed516f35c017efbdce5f Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Wed, 20 Sep 2017 21:53:08 +0530 Subject: src: Change parameters of SNPRINTF_BUFFER_SIZE macro. SNPRINTF_BUFFER_SIZE() macro declaration and definition is changed so that it accepts three arguments ret, remain and offset. Parameters size and len are not required instead parameter remain keeps track of available space in the buffer. Signed-off-by: Varsha Rao --- src/expr/lookup.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/expr/lookup.c') diff --git a/src/expr/lookup.c b/src/expr/lookup.c index 861815f..e4c05ec 100644 --- a/src/expr/lookup.c +++ b/src/expr/lookup.c @@ -219,20 +219,20 @@ static int nftnl_expr_lookup_snprintf_default(char *buf, size_t size, const struct nftnl_expr *e) { - int len = size, offset = 0, ret; + int remain = size, offset = 0, ret; struct nftnl_expr_lookup *l = nftnl_expr_data(e); - ret = snprintf(buf, len, "reg %u set %s ", l->sreg, l->set_name); - SNPRINTF_BUFFER_SIZE(ret, size, len, offset); + ret = snprintf(buf, remain, "reg %u set %s ", l->sreg, l->set_name); + SNPRINTF_BUFFER_SIZE(ret, remain, offset); if (e->flags & (1 << NFTNL_EXPR_LOOKUP_DREG)) { - ret = snprintf(buf+offset, len, "dreg %u ", l->dreg); - SNPRINTF_BUFFER_SIZE(ret, size, len, offset); + ret = snprintf(buf + offset, remain, "dreg %u ", l->dreg); + SNPRINTF_BUFFER_SIZE(ret, remain, offset); } if (e->flags & (1 << NFTNL_EXPR_LOOKUP_FLAGS)) { - ret = snprintf(buf + offset, len, "0x%x ", l->flags); - SNPRINTF_BUFFER_SIZE(ret, size, len, offset); + ret = snprintf(buf + offset, remain, "0x%x ", l->flags); + SNPRINTF_BUFFER_SIZE(ret, remain, offset); } return offset; -- cgit v1.2.3