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/redir.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/expr/redir.c') diff --git a/src/expr/redir.c b/src/expr/redir.c index 43538d5..b2aa345 100644 --- a/src/expr/redir.c +++ b/src/expr/redir.c @@ -176,25 +176,25 @@ static int nftnl_expr_redir_export(char *buf, size_t size, static int nftnl_expr_redir_snprintf_default(char *buf, size_t len, const struct nftnl_expr *e) { - int ret, size = len, offset = 0; + int ret, remain = len, offset = 0; struct nftnl_expr_redir *redir = nftnl_expr_data(e); if (nftnl_expr_is_set(e, NFTNL_EXPR_REDIR_REG_PROTO_MIN)) { ret = snprintf(buf + offset, len, "proto_min reg %u ", redir->sreg_proto_min); - SNPRINTF_BUFFER_SIZE(ret, size, len, offset); + SNPRINTF_BUFFER_SIZE(ret, remain, offset); } if (nftnl_expr_is_set(e, NFTNL_EXPR_REDIR_REG_PROTO_MAX)) { ret = snprintf(buf + offset, len, "proto_max reg %u ", redir->sreg_proto_max); - SNPRINTF_BUFFER_SIZE(ret, size, len, offset); + SNPRINTF_BUFFER_SIZE(ret, remain, offset); } if (nftnl_expr_is_set(e, NFTNL_EXPR_REDIR_FLAGS)) { - ret = snprintf(buf + offset , len, "flags 0x%x ", + ret = snprintf(buf + offset, len, "flags 0x%x ", redir->flags); - SNPRINTF_BUFFER_SIZE(ret, size, len, offset); + SNPRINTF_BUFFER_SIZE(ret, remain, offset); } return offset; -- cgit v1.2.3