Skip to contentSkip to conversation

nftables: Change size_t len to size_t size

PATCH In review Meghana Madhyastha 2 participants 4 messages Oct 4, 2017 – Oct 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nftables: Change size_t len to size_t size

Change the variable name from size_t len to
size_t size in the sprintf functions for
consistency.

---
 src/expr/counter.c   | 12 ++++++------
 src/expr/ct.c        |  8 ++++----
 src/expr/dup.c       | 16 ++++++++--------
 src/expr/exthdr.c    | 14 +++++++-------
 src/expr/fib.c       |  8 ++++----
 src/expr/fwd.c       | 12 ++++++------
 src/expr/hash.c      |  8 ++++----
 src/expr/immediate.c | 12 ++++++------
 src/expr/limit.c     | 12 ++++++------
 src/expr/log.c       |  8 ++++----
 src/expr/masq.c      | 14 +++++++-------
 src/expr/match.c     |  8 ++++----
 src/expr/meta.c      | 14 +++++++-------
 src/expr/numgen.c    |  8 ++++----
 src/expr/objref.c    | 14 +++++++-------
 src/expr/payload.c   | 10 +++++-----
 src/expr/queue.c     | 24 ++++++++++++------------
 src/expr/quota.c     | 12 ++++++------
 src/expr/redir.c     | 18 +++++++++---------
 src/expr/reject.c    | 12 ++++++------
 src/expr/rt.c        | 12 ++++++------
 src/expr/target.c    |  8 ++++----
 22 files changed, 132 insertions(+), 132 deletions(-)
src/expr/counter.c +6 -6
index 5c196d4..4de6b92 100644
@@ -151,28 +151,28 @@ static int nftnl_expr_counter_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_counter_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_counter_snprintf_default(char *buf, size_t size,
 					       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_counter *ctr = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "pkts %"PRIu64" bytes %"PRIu64" ",
+	return snprintf(buf, size, "pkts %"PRIu64" bytes %"PRIu64" ",
 			ctr->pkts, ctr->bytes);
 }
 
-static int nftnl_expr_counter_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_counter_snprintf(char *buf, size_t size, uint32_t type,
 				       uint32_t flags,
 				       const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_counter_snprintf_default(buf, len, e);
+		return nftnl_expr_counter_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_counter_export(buf, len, e, type);
+		return nftnl_expr_counter_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/ct.c +4 -4
index 021a277..396bee0 100644
@@ -314,18 +314,18 @@ nftnl_expr_ct_snprintf_default(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_ct_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_ct_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_ct_snprintf_default(buf, len, e);
+		return nftnl_expr_ct_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_ct_export(buf, len, e, type);
+		return nftnl_expr_ct_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/dup.c +8 -8
index e2171f4..f67331b 100644
@@ -147,38 +147,38 @@ static int nftnl_expr_dup_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_dup_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_dup_snprintf_default(char *buf, size_t size,
 					   const struct nftnl_expr *e,
 					   uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_dup *dup = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_DUP_SREG_ADDR)) {
-		ret = snprintf(buf + offset, len, "sreg_addr %u ", dup->sreg_addr);
+		ret = snprintf(buf + offset, size, "sreg_addr %u ", dup->sreg_addr);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_DUP_SREG_DEV)) {
-		ret = snprintf(buf + offset, len, "sreg_dev %u ", dup->sreg_dev);
+		ret = snprintf(buf + offset, size, "sreg_dev %u ", dup->sreg_dev);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	return offset;
 }
 
-static int nftnl_expr_dup_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_dup_snprintf(char *buf, size_t size, uint32_t type,
 				   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_dup_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_dup_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_dup_export(buf, len, e, type);
+		return nftnl_expr_dup_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/exthdr.c +7 -7
index 11766fa..12f49d8 100644
@@ -317,37 +317,37 @@ static int nftnl_expr_exthdr_export(char *buf, size_t len,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_exthdr_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_exthdr_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_exthdr *exthdr = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_EXTHDR_DREG))
-		return snprintf(buf, len, "load%s %ub @ %u + %u%s => reg %u ",
+		return snprintf(buf, size, "load%s %ub @ %u + %u%s => reg %u ",
 				op2str(exthdr->op), exthdr->len, exthdr->type,
 				exthdr->offset,
 				exthdr->flags & NFT_EXTHDR_F_PRESENT ? " present" : "",
 				exthdr->dreg);
 	else
-		return snprintf(buf, len, "write%s reg %u => %ub @ %u + %u ",
+		return snprintf(buf, size, "write%s reg %u => %ub @ %u + %u ",
 				op2str(exthdr->op), exthdr->sreg, exthdr->len, exthdr->type,
 				exthdr->offset);
 
 }
 
 static int
-nftnl_expr_exthdr_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_exthdr_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_exthdr_snprintf_default(buf, len, e);
+		return nftnl_expr_exthdr_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_exthdr_export(buf, len, e, type);
+		return nftnl_expr_exthdr_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/fib.c +4 -4
index cbadeef..cb62020 100644
@@ -233,18 +233,18 @@ static int nftnl_expr_fib_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_fib_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_fib_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_fib_snprintf_default(buf, len, e);
+		return nftnl_expr_fib_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_fib_export(buf, len, e, type);
+		return nftnl_expr_fib_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/fwd.c +6 -6
index 38923df..9b5e555 100644
@@ -128,11 +128,11 @@ static int nftnl_expr_fwd_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_fwd_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_fwd_snprintf_default(char *buf, size_t size,
 					   const struct nftnl_expr *e,
 					   uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_fwd *fwd = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_FWD_SREG_DEV)) {
@@ -144,18 +144,18 @@ static int nftnl_expr_fwd_snprintf_default(char *buf, size_t len,
 	return offset;
 }
 
-static int nftnl_expr_fwd_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_fwd_snprintf(char *buf, size_t size, uint32_t type,
 				   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_fwd_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_fwd_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_fwd_export(buf, len, e, type);
+		return nftnl_expr_fwd_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/hash.c +4 -4
index 066c790..6a52308 100644
@@ -285,18 +285,18 @@ static int nftnl_expr_hash_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_hash_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_hash_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_hash_snprintf_default(buf, len, e);
+		return nftnl_expr_hash_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_hash_export(buf, len, e, type);
+		return nftnl_expr_hash_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/immediate.c +6 -6
index aba84ea..5cdad03 100644
@@ -229,11 +229,11 @@ nftnl_expr_immediate_export(char *buf, size_t size, const struct nftnl_expr *e,
 }
 
 static int
-nftnl_expr_immediate_snprintf_default(char *buf, size_t len,
+nftnl_expr_immediate_snprintf_default(char *buf, size_t size,
 				      const struct nftnl_expr *e,
 				      uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_immediate *imm = nftnl_expr_data(e);
 
 	ret = snprintf(buf, remain, "reg %u ", imm->dreg);
@@ -259,18 +259,18 @@ nftnl_expr_immediate_snprintf_default(char *buf, size_t len,
 }
 
 static int
-nftnl_expr_immediate_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_immediate_snprintf(char *buf, size_t size, uint32_t type,
 			      uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_immediate_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_immediate_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_immediate_export(buf, len, e, type);
+		return nftnl_expr_immediate_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/limit.c +6 -6
index 8e1f02a..3927dbf 100644
@@ -229,29 +229,29 @@ static const char *limit_to_type(enum nft_limit_type type)
 	}
 }
 
-static int nftnl_expr_limit_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_limit_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
 	struct nftnl_expr_limit *limit = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "rate %"PRIu64"/%s burst %u type %s flags 0x%x ",
+	return snprintf(buf, size, "rate %"PRIu64"/%s burst %u type %s flags 0x%x ",
 			limit->rate, get_unit(limit->unit), limit->burst,
 			limit_to_type(limit->type), limit->flags);
 }
 
 static int
-nftnl_expr_limit_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_limit_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_limit_snprintf_default(buf, len, e);
+		return nftnl_expr_limit_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_limit_export(buf, len, e, type);
+		return nftnl_expr_limit_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/log.c +4 -4
index 161327b..48abc9c 100644
@@ -298,18 +298,18 @@ static int nftnl_expr_log_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_log_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_log_snprintf(char *buf, size_t size, uint32_t type,
 			uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_log_snprintf_default(buf, len, e);
+		return nftnl_expr_log_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_log_export(buf, len, e, type);
+		return nftnl_expr_log_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/masq.c +7 -7
index 1c75ee9..76d3eea 100644
@@ -171,15 +171,15 @@ static int nftnl_expr_masq_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_masq_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_masq_snprintf_default(char *buf, size_t size,
 					    const struct nftnl_expr *e)
 {
 	struct nftnl_expr_masq *masq = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_MASQ_FLAGS))
-		return snprintf(buf, len, "flags 0x%x ", masq->flags);
+		return snprintf(buf, size, "flags 0x%x ", masq->flags);
 	if (e->flags & (1 << NFTNL_EXPR_MASQ_REG_PROTO_MIN)) {
-		return snprintf(buf, len,
+		return snprintf(buf, size,
 				"proto_min reg %u proto_max reg %u ",
 				masq->sreg_proto_min, masq->sreg_proto_max);
 	}
@@ -187,18 +187,18 @@ static int nftnl_expr_masq_snprintf_default(char *buf, size_t len,
 	return 0;
 }
 
-static int nftnl_expr_masq_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_masq_snprintf(char *buf, size_t size, uint32_t type,
 				    uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_masq_snprintf_default(buf, len, e);
+		return nftnl_expr_masq_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_masq_export(buf, len, e, type);
+		return nftnl_expr_masq_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/match.c +4 -4
index af659b3..431c339 100644
@@ -195,21 +195,21 @@ static int nftnl_expr_match_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_match_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_match_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_match *match = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return snprintf(buf, len, "name %s rev %u ",
+		return snprintf(buf, size, "name %s rev %u ",
 				match->name, match->rev);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_match_export(buf, len, e, type);
+		return nftnl_expr_match_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/meta.c +7 -7
index b5c27e6..95e84ad 100644
@@ -216,17 +216,17 @@ static int nftnl_expr_meta_json_parse(struct nftnl_expr *e, json_t *root,
 }
 
 static int
-nftnl_expr_meta_snprintf_default(char *buf, size_t len,
+nftnl_expr_meta_snprintf_default(char *buf, size_t size,
 				 const struct nftnl_expr *e)
 {
 	struct nftnl_expr_meta *meta = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_META_SREG)) {
-		return snprintf(buf, len, "set %s with reg %u ",
+		return snprintf(buf, size, "set %s with reg %u ",
 				meta_key2str(meta->key), meta->sreg);
 	}
 	if (e->flags & (1 << NFTNL_EXPR_META_DREG)) {
-		return snprintf(buf, len, "load %s => reg %u ",
+		return snprintf(buf, size, "load %s => reg %u ",
 				meta_key2str(meta->key), meta->dreg);
 	}
 	return 0;
@@ -249,18 +249,18 @@ static int nftnl_expr_meta_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_meta_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_meta_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_meta_snprintf_default(buf, len, e);
+		return nftnl_expr_meta_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_meta_export(buf, len, e, type);
+		return nftnl_expr_meta_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/numgen.c +4 -4
index 9b5b1b7..83c493a 100644
@@ -221,18 +221,18 @@ static int nftnl_expr_ng_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_ng_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_ng_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_ng_snprintf_default(buf, len, e);
+		return nftnl_expr_ng_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_ng_export(buf, len, e, type);
+		return nftnl_expr_ng_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/objref.c +7 -7
index b4b3383..340dc67 100644
@@ -219,32 +219,32 @@ static int nftnl_expr_objref_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_objref_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_objref_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_objref *objref = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_OBJREF_SET_SREG))
-		return snprintf(buf, len, "sreg %u set %s id %u ",
+		return snprintf(buf, size, "sreg %u set %s id %u ",
 				objref->set.sreg, objref->set.name, objref->set.id);
 	else
-		return snprintf(buf, len, "type %u name %s ",
+		return snprintf(buf, size, "type %u name %s ",
 				objref->imm.type, objref->imm.name);
 }
 
-static int nftnl_expr_objref_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_objref_snprintf(char *buf, size_t size, uint32_t type,
 				      uint32_t flags,
 				      const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_objref_snprintf_default(buf, len, e);
+		return nftnl_expr_objref_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_objref_export(buf, len, e, type);
+		return nftnl_expr_objref_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/payload.c +5 -5
index 897fc77..d61e854 100644
@@ -285,30 +285,30 @@ static int nftnl_expr_payload_export(char *buf, size_t size, uint32_t flags,
 }
 
 static int
-nftnl_expr_payload_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_payload_snprintf(char *buf, size_t size, uint32_t type,
 			    uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_payload *payload = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
 		if (payload->sreg)
-			return snprintf(buf, len, "write reg %u => %ub @ %s header + %u csum_type %u csum_off %u csum_flags 0x%x ",
+			return snprintf(buf, size, "write reg %u => %ub @ %s header + %u csum_type %u csum_off %u csum_flags 0x%x ",
 					payload->sreg,
 					payload->len, base2str(payload->base),
 					payload->offset, payload->csum_type,
 					payload->csum_offset,
 					payload->csum_flags);
 		else
-			return snprintf(buf, len, "load %ub @ %s header + %u => reg %u ",
+			return snprintf(buf, size, "load %ub @ %s header + %u => reg %u ",
 					payload->len, base2str(payload->base),
 					payload->offset, payload->dreg);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_payload_export(buf, len, flags, e, type);
+		return nftnl_expr_payload_export(buf, size, flags, e, type);
 	default:
 		break;
 	}
src/expr/queue.c +12 -12
index e0fb785..acb42e9 100644
@@ -172,41 +172,41 @@ nftnl_expr_queue_json_parse(struct nftnl_expr *e, json_t *root,
 #endif
 }
 
-static int nftnl_expr_queue_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_queue_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
 	struct nftnl_expr_queue *queue = nftnl_expr_data(e);
-	int ret, remain = len, offset = 0;
+	int ret, remain = size, offset = 0;
 	uint16_t total_queues;
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_NUM)) {
 		total_queues = queue->queuenum + queue->queues_total - 1;
 
-		ret = snprintf(buf + offset, len, "num %u", queue->queuenum);
+		ret = snprintf(buf + offset, size, "num %u", queue->queuenum);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 
 		if (queue->queues_total && total_queues != queue->queuenum) {
-			ret = snprintf(buf + offset, len, "-%u", total_queues);
+			ret = snprintf(buf + offset, size, "-%u", total_queues);
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 
-		ret = snprintf(buf + offset, len, " ");
+		ret = snprintf(buf + offset, size, " ");
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_SREG_QNUM)) {
-		ret = snprintf(buf + offset, len, "sreg_qnum %u ",
+		ret = snprintf(buf + offset, size, "sreg_qnum %u ",
 			       queue->sreg_qnum);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_FLAGS)) {
 		if (queue->flags & (NFT_QUEUE_FLAG_BYPASS)) {
-			ret = snprintf(buf + offset, len, "bypass ");
+			ret = snprintf(buf + offset, size, "bypass ");
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 		if (queue->flags & (NFT_QUEUE_FLAG_CPU_FANOUT)) {
-			ret = snprintf(buf + offset, len, "fanout ");
+			ret = snprintf(buf + offset, size, "fanout ");
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 	}
@@ -232,18 +232,18 @@ static int nftnl_expr_queue_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_queue_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_queue_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_queue_snprintf_default(buf, len, e);
+		return nftnl_expr_queue_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_queue_export(buf, len, e, type);
+		return nftnl_expr_queue_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/quota.c +6 -6
index c247b0a..e9cc708 100644
@@ -169,29 +169,29 @@ static int nftnl_expr_quota_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_quota_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_quota_snprintf_default(char *buf, size_t size,
 					       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_quota *quota = nftnl_expr_data(e);
 
-	return snprintf(buf, len,
+	return snprintf(buf, size,
 			"bytes %"PRIu64" consumed %"PRIu64" flags %u ",
 			quota->bytes, quota->consumed, quota->flags);
 }
 
-static int nftnl_expr_quota_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_quota_snprintf(char *buf, size_t size, uint32_t type,
 				       uint32_t flags,
 				       const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_quota_snprintf_default(buf, len, e);
+		return nftnl_expr_quota_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_quota_export(buf, len, e, type);
+		return nftnl_expr_quota_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/redir.c +9 -9
index 9fb634a..b58635c 100644
@@ -173,26 +173,26 @@ static int nftnl_expr_redir_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_redir_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_redir_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
-	int ret, remain = len, offset = 0;
+	int ret, remain = size, 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 ",
+		ret = snprintf(buf + offset, size, "proto_min reg %u ",
 			       redir->sreg_proto_min);
 		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 ",
+		ret = snprintf(buf + offset, size, "proto_max reg %u ",
 			       redir->sreg_proto_max);
 		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, size, "flags 0x%x ",
 			       redir->flags);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
@@ -201,18 +201,18 @@ static int nftnl_expr_redir_snprintf_default(char *buf, size_t len,
 }
 
 static int
-nftnl_expr_redir_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_redir_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_redir_snprintf_default(buf, len, e);
+		return nftnl_expr_redir_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_redir_export(buf, len, e, type);
+		return nftnl_expr_redir_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/reject.c +6 -6
index 1e6fdf5..01bafb4 100644
@@ -137,12 +137,12 @@ nftnl_expr_reject_json_parse(struct nftnl_expr *e, json_t *root,
 #endif
 }
 
-static int nftnl_expr_reject_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_reject_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_reject *reject = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "type %u code %u ",
+	return snprintf(buf, size, "type %u code %u ",
 			reject->type, reject->icmp_code);
 }
 
@@ -161,18 +161,18 @@ static int nftnl_expr_reject_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_reject_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_reject_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_reject_snprintf_default(buf, len, e);
+		return nftnl_expr_reject_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_reject_export(buf, len, e, type);
+		return nftnl_expr_reject_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/rt.c +6 -6
index 10cb1e2..408b9a9 100644
@@ -173,13 +173,13 @@ static int nftnl_expr_rt_json_parse(struct nftnl_expr *e, json_t *root,
 }
 
 static int
-nftnl_expr_rt_snprintf_default(char *buf, size_t len,
+nftnl_expr_rt_snprintf_default(char *buf, size_t size,
 			       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_rt *rt = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_RT_DREG)) {
-		return snprintf(buf, len, "load %s => reg %u ",
+		return snprintf(buf, size, "load %s => reg %u ",
 				rt_key2str(rt->key), rt->dreg);
 	}
 	return 0;
@@ -200,18 +200,18 @@ static int nftnl_expr_rt_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_rt_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_rt_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_rt_snprintf_default(buf, len, e);
+		return nftnl_expr_rt_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_rt_export(buf, len, e, type);
+		return nftnl_expr_rt_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/target.c +4 -4
index 3c58b03..524b378 100644
@@ -195,21 +195,21 @@ static int nftnl_rule_exp_target_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_target_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_target_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_target *target = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return snprintf(buf, len, "name %s rev %u ",
+		return snprintf(buf, size, "name %s rev %u ",
 				target->name, target->rev);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_rule_exp_target_export(buf, len, e, type);
+		return nftnl_rule_exp_target_export(buf, size, e, type);
 	default:
 		break;
 	}
Signature · 1 line
2.7.4
#1 lore raw
Quoted 3 lines · Meghana Madhyastha

Change the variable name from size_t len to
size_t size in the sprintf functions for
consistency.

It looks like a lot of changes. Is size_t size already used in a lot of other places?

Try to make log messages the use more of the horizontal space.

julia

Quoted 932 lines
---
 src/expr/counter.c   | 12 ++++++------
 src/expr/ct.c        |  8 ++++----
 src/expr/dup.c       | 16 ++++++++--------
 src/expr/exthdr.c    | 14 +++++++-------
 src/expr/fib.c       |  8 ++++----
 src/expr/fwd.c       | 12 ++++++------
 src/expr/hash.c      |  8 ++++----
 src/expr/immediate.c | 12 ++++++------
 src/expr/limit.c     | 12 ++++++------
 src/expr/log.c       |  8 ++++----
 src/expr/masq.c      | 14 +++++++-------
 src/expr/match.c     |  8 ++++----
 src/expr/meta.c      | 14 +++++++-------
 src/expr/numgen.c    |  8 ++++----
 src/expr/objref.c    | 14 +++++++-------
 src/expr/payload.c   | 10 +++++-----
 src/expr/queue.c     | 24 ++++++++++++------------
 src/expr/quota.c     | 12 ++++++------
 src/expr/redir.c     | 18 +++++++++---------
 src/expr/reject.c    | 12 ++++++------
 src/expr/rt.c        | 12 ++++++------
 src/expr/target.c    |  8 ++++----
 22 files changed, 132 insertions(+), 132 deletions(-)
src/expr/counter.c +6 -6
index 5c196d4..4de6b92 100644
@@ -151,28 +151,28 @@ static int nftnl_expr_counter_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_counter_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_counter_snprintf_default(char *buf, size_t size,
 					       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_counter *ctr = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "pkts %"PRIu64" bytes %"PRIu64" ",
+	return snprintf(buf, size, "pkts %"PRIu64" bytes %"PRIu64" ",
 			ctr->pkts, ctr->bytes);
 }
 
-static int nftnl_expr_counter_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_counter_snprintf(char *buf, size_t size, uint32_t type,
 				       uint32_t flags,
 				       const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_counter_snprintf_default(buf, len, e);
+		return nftnl_expr_counter_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_counter_export(buf, len, e, type);
+		return nftnl_expr_counter_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/ct.c +4 -4
index 021a277..396bee0 100644
@@ -314,18 +314,18 @@ nftnl_expr_ct_snprintf_default(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_ct_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_ct_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_ct_snprintf_default(buf, len, e);
+		return nftnl_expr_ct_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_ct_export(buf, len, e, type);
+		return nftnl_expr_ct_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/dup.c +8 -8
index e2171f4..f67331b 100644
@@ -147,38 +147,38 @@ static int nftnl_expr_dup_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_dup_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_dup_snprintf_default(char *buf, size_t size,
 					   const struct nftnl_expr *e,
 					   uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_dup *dup = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_DUP_SREG_ADDR)) {
-		ret = snprintf(buf + offset, len, "sreg_addr %u ", dup->sreg_addr);
+		ret = snprintf(buf + offset, size, "sreg_addr %u ", dup->sreg_addr);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_DUP_SREG_DEV)) {
-		ret = snprintf(buf + offset, len, "sreg_dev %u ", dup->sreg_dev);
+		ret = snprintf(buf + offset, size, "sreg_dev %u ", dup->sreg_dev);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	return offset;
 }
 
-static int nftnl_expr_dup_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_dup_snprintf(char *buf, size_t size, uint32_t type,
 				   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_dup_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_dup_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_dup_export(buf, len, e, type);
+		return nftnl_expr_dup_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/exthdr.c +7 -7
index 11766fa..12f49d8 100644
@@ -317,37 +317,37 @@ static int nftnl_expr_exthdr_export(char *buf, size_t len,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_exthdr_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_exthdr_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_exthdr *exthdr = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_EXTHDR_DREG))
-		return snprintf(buf, len, "load%s %ub @ %u + %u%s => reg %u ",
+		return snprintf(buf, size, "load%s %ub @ %u + %u%s => reg %u ",
 				op2str(exthdr->op), exthdr->len, exthdr->type,
 				exthdr->offset,
 				exthdr->flags & NFT_EXTHDR_F_PRESENT ? " present" : "",
 				exthdr->dreg);
 	else
-		return snprintf(buf, len, "write%s reg %u => %ub @ %u + %u ",
+		return snprintf(buf, size, "write%s reg %u => %ub @ %u + %u ",
 				op2str(exthdr->op), exthdr->sreg, exthdr->len, exthdr->type,
 				exthdr->offset);
 
 }
 
 static int
-nftnl_expr_exthdr_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_exthdr_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_exthdr_snprintf_default(buf, len, e);
+		return nftnl_expr_exthdr_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_exthdr_export(buf, len, e, type);
+		return nftnl_expr_exthdr_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/fib.c +4 -4
index cbadeef..cb62020 100644
@@ -233,18 +233,18 @@ static int nftnl_expr_fib_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_fib_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_fib_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_fib_snprintf_default(buf, len, e);
+		return nftnl_expr_fib_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_fib_export(buf, len, e, type);
+		return nftnl_expr_fib_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/fwd.c +6 -6
index 38923df..9b5e555 100644
@@ -128,11 +128,11 @@ static int nftnl_expr_fwd_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_fwd_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_fwd_snprintf_default(char *buf, size_t size,
 					   const struct nftnl_expr *e,
 					   uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_fwd *fwd = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_FWD_SREG_DEV)) {
@@ -144,18 +144,18 @@ static int nftnl_expr_fwd_snprintf_default(char *buf, size_t len,
 	return offset;
 }
 
-static int nftnl_expr_fwd_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_fwd_snprintf(char *buf, size_t size, uint32_t type,
 				   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_fwd_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_fwd_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_fwd_export(buf, len, e, type);
+		return nftnl_expr_fwd_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/hash.c +4 -4
index 066c790..6a52308 100644
@@ -285,18 +285,18 @@ static int nftnl_expr_hash_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_hash_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_hash_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_hash_snprintf_default(buf, len, e);
+		return nftnl_expr_hash_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_hash_export(buf, len, e, type);
+		return nftnl_expr_hash_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/immediate.c +6 -6
index aba84ea..5cdad03 100644
@@ -229,11 +229,11 @@ nftnl_expr_immediate_export(char *buf, size_t size, const struct nftnl_expr *e,
 }
 
 static int
-nftnl_expr_immediate_snprintf_default(char *buf, size_t len,
+nftnl_expr_immediate_snprintf_default(char *buf, size_t size,
 				      const struct nftnl_expr *e,
 				      uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_immediate *imm = nftnl_expr_data(e);
 
 	ret = snprintf(buf, remain, "reg %u ", imm->dreg);
@@ -259,18 +259,18 @@ nftnl_expr_immediate_snprintf_default(char *buf, size_t len,
 }
 
 static int
-nftnl_expr_immediate_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_immediate_snprintf(char *buf, size_t size, uint32_t type,
 			      uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_immediate_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_immediate_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_immediate_export(buf, len, e, type);
+		return nftnl_expr_immediate_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/limit.c +6 -6
index 8e1f02a..3927dbf 100644
@@ -229,29 +229,29 @@ static const char *limit_to_type(enum nft_limit_type type)
 	}
 }
 
-static int nftnl_expr_limit_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_limit_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
 	struct nftnl_expr_limit *limit = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "rate %"PRIu64"/%s burst %u type %s flags 0x%x ",
+	return snprintf(buf, size, "rate %"PRIu64"/%s burst %u type %s flags 0x%x ",
 			limit->rate, get_unit(limit->unit), limit->burst,
 			limit_to_type(limit->type), limit->flags);
 }
 
 static int
-nftnl_expr_limit_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_limit_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_limit_snprintf_default(buf, len, e);
+		return nftnl_expr_limit_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_limit_export(buf, len, e, type);
+		return nftnl_expr_limit_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/log.c +4 -4
index 161327b..48abc9c 100644
@@ -298,18 +298,18 @@ static int nftnl_expr_log_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_log_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_log_snprintf(char *buf, size_t size, uint32_t type,
 			uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_log_snprintf_default(buf, len, e);
+		return nftnl_expr_log_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_log_export(buf, len, e, type);
+		return nftnl_expr_log_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/masq.c +7 -7
index 1c75ee9..76d3eea 100644
@@ -171,15 +171,15 @@ static int nftnl_expr_masq_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_masq_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_masq_snprintf_default(char *buf, size_t size,
 					    const struct nftnl_expr *e)
 {
 	struct nftnl_expr_masq *masq = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_MASQ_FLAGS))
-		return snprintf(buf, len, "flags 0x%x ", masq->flags);
+		return snprintf(buf, size, "flags 0x%x ", masq->flags);
 	if (e->flags & (1 << NFTNL_EXPR_MASQ_REG_PROTO_MIN)) {
-		return snprintf(buf, len,
+		return snprintf(buf, size,
 				"proto_min reg %u proto_max reg %u ",
 				masq->sreg_proto_min, masq->sreg_proto_max);
 	}
@@ -187,18 +187,18 @@ static int nftnl_expr_masq_snprintf_default(char *buf, size_t len,
 	return 0;
 }
 
-static int nftnl_expr_masq_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_masq_snprintf(char *buf, size_t size, uint32_t type,
 				    uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_masq_snprintf_default(buf, len, e);
+		return nftnl_expr_masq_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_masq_export(buf, len, e, type);
+		return nftnl_expr_masq_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/match.c +4 -4
index af659b3..431c339 100644
@@ -195,21 +195,21 @@ static int nftnl_expr_match_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_match_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_match_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_match *match = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return snprintf(buf, len, "name %s rev %u ",
+		return snprintf(buf, size, "name %s rev %u ",
 				match->name, match->rev);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_match_export(buf, len, e, type);
+		return nftnl_expr_match_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/meta.c +7 -7
index b5c27e6..95e84ad 100644
@@ -216,17 +216,17 @@ static int nftnl_expr_meta_json_parse(struct nftnl_expr *e, json_t *root,
 }
 
 static int
-nftnl_expr_meta_snprintf_default(char *buf, size_t len,
+nftnl_expr_meta_snprintf_default(char *buf, size_t size,
 				 const struct nftnl_expr *e)
 {
 	struct nftnl_expr_meta *meta = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_META_SREG)) {
-		return snprintf(buf, len, "set %s with reg %u ",
+		return snprintf(buf, size, "set %s with reg %u ",
 				meta_key2str(meta->key), meta->sreg);
 	}
 	if (e->flags & (1 << NFTNL_EXPR_META_DREG)) {
-		return snprintf(buf, len, "load %s => reg %u ",
+		return snprintf(buf, size, "load %s => reg %u ",
 				meta_key2str(meta->key), meta->dreg);
 	}
 	return 0;
@@ -249,18 +249,18 @@ static int nftnl_expr_meta_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_meta_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_meta_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_meta_snprintf_default(buf, len, e);
+		return nftnl_expr_meta_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_meta_export(buf, len, e, type);
+		return nftnl_expr_meta_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/numgen.c +4 -4
index 9b5b1b7..83c493a 100644
@@ -221,18 +221,18 @@ static int nftnl_expr_ng_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_ng_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_ng_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_ng_snprintf_default(buf, len, e);
+		return nftnl_expr_ng_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_ng_export(buf, len, e, type);
+		return nftnl_expr_ng_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/objref.c +7 -7
index b4b3383..340dc67 100644
@@ -219,32 +219,32 @@ static int nftnl_expr_objref_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_objref_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_objref_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_objref *objref = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_OBJREF_SET_SREG))
-		return snprintf(buf, len, "sreg %u set %s id %u ",
+		return snprintf(buf, size, "sreg %u set %s id %u ",
 				objref->set.sreg, objref->set.name, objref->set.id);
 	else
-		return snprintf(buf, len, "type %u name %s ",
+		return snprintf(buf, size, "type %u name %s ",
 				objref->imm.type, objref->imm.name);
 }
 
-static int nftnl_expr_objref_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_objref_snprintf(char *buf, size_t size, uint32_t type,
 				      uint32_t flags,
 				      const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_objref_snprintf_default(buf, len, e);
+		return nftnl_expr_objref_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_objref_export(buf, len, e, type);
+		return nftnl_expr_objref_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/payload.c +5 -5
index 897fc77..d61e854 100644
@@ -285,30 +285,30 @@ static int nftnl_expr_payload_export(char *buf, size_t size, uint32_t flags,
 }
 
 static int
-nftnl_expr_payload_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_payload_snprintf(char *buf, size_t size, uint32_t type,
 			    uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_payload *payload = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
 		if (payload->sreg)
-			return snprintf(buf, len, "write reg %u => %ub @ %s header + %u csum_type %u csum_off %u csum_flags 0x%x ",
+			return snprintf(buf, size, "write reg %u => %ub @ %s header + %u csum_type %u csum_off %u csum_flags 0x%x ",
 					payload->sreg,
 					payload->len, base2str(payload->base),
 					payload->offset, payload->csum_type,
 					payload->csum_offset,
 					payload->csum_flags);
 		else
-			return snprintf(buf, len, "load %ub @ %s header + %u => reg %u ",
+			return snprintf(buf, size, "load %ub @ %s header + %u => reg %u ",
 					payload->len, base2str(payload->base),
 					payload->offset, payload->dreg);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_payload_export(buf, len, flags, e, type);
+		return nftnl_expr_payload_export(buf, size, flags, e, type);
 	default:
 		break;
 	}
src/expr/queue.c +12 -12
index e0fb785..acb42e9 100644
@@ -172,41 +172,41 @@ nftnl_expr_queue_json_parse(struct nftnl_expr *e, json_t *root,
 #endif
 }
 
-static int nftnl_expr_queue_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_queue_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
 	struct nftnl_expr_queue *queue = nftnl_expr_data(e);
-	int ret, remain = len, offset = 0;
+	int ret, remain = size, offset = 0;
 	uint16_t total_queues;
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_NUM)) {
 		total_queues = queue->queuenum + queue->queues_total - 1;
 
-		ret = snprintf(buf + offset, len, "num %u", queue->queuenum);
+		ret = snprintf(buf + offset, size, "num %u", queue->queuenum);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 
 		if (queue->queues_total && total_queues != queue->queuenum) {
-			ret = snprintf(buf + offset, len, "-%u", total_queues);
+			ret = snprintf(buf + offset, size, "-%u", total_queues);
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 
-		ret = snprintf(buf + offset, len, " ");
+		ret = snprintf(buf + offset, size, " ");
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_SREG_QNUM)) {
-		ret = snprintf(buf + offset, len, "sreg_qnum %u ",
+		ret = snprintf(buf + offset, size, "sreg_qnum %u ",
 			       queue->sreg_qnum);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_FLAGS)) {
 		if (queue->flags & (NFT_QUEUE_FLAG_BYPASS)) {
-			ret = snprintf(buf + offset, len, "bypass ");
+			ret = snprintf(buf + offset, size, "bypass ");
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 		if (queue->flags & (NFT_QUEUE_FLAG_CPU_FANOUT)) {
-			ret = snprintf(buf + offset, len, "fanout ");
+			ret = snprintf(buf + offset, size, "fanout ");
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 	}
@@ -232,18 +232,18 @@ static int nftnl_expr_queue_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_queue_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_queue_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_queue_snprintf_default(buf, len, e);
+		return nftnl_expr_queue_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_queue_export(buf, len, e, type);
+		return nftnl_expr_queue_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/quota.c +6 -6
index c247b0a..e9cc708 100644
@@ -169,29 +169,29 @@ static int nftnl_expr_quota_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_quota_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_quota_snprintf_default(char *buf, size_t size,
 					       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_quota *quota = nftnl_expr_data(e);
 
-	return snprintf(buf, len,
+	return snprintf(buf, size,
 			"bytes %"PRIu64" consumed %"PRIu64" flags %u ",
 			quota->bytes, quota->consumed, quota->flags);
 }
 
-static int nftnl_expr_quota_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_quota_snprintf(char *buf, size_t size, uint32_t type,
 				       uint32_t flags,
 				       const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_quota_snprintf_default(buf, len, e);
+		return nftnl_expr_quota_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_quota_export(buf, len, e, type);
+		return nftnl_expr_quota_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/redir.c +9 -9
index 9fb634a..b58635c 100644
@@ -173,26 +173,26 @@ static int nftnl_expr_redir_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_redir_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_redir_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
-	int ret, remain = len, offset = 0;
+	int ret, remain = size, 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 ",
+		ret = snprintf(buf + offset, size, "proto_min reg %u ",
 			       redir->sreg_proto_min);
 		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 ",
+		ret = snprintf(buf + offset, size, "proto_max reg %u ",
 			       redir->sreg_proto_max);
 		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, size, "flags 0x%x ",
 			       redir->flags);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
@@ -201,18 +201,18 @@ static int nftnl_expr_redir_snprintf_default(char *buf, size_t len,
 }
 
 static int
-nftnl_expr_redir_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_redir_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_redir_snprintf_default(buf, len, e);
+		return nftnl_expr_redir_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_redir_export(buf, len, e, type);
+		return nftnl_expr_redir_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/reject.c +6 -6
index 1e6fdf5..01bafb4 100644
@@ -137,12 +137,12 @@ nftnl_expr_reject_json_parse(struct nftnl_expr *e, json_t *root,
 #endif
 }
 
-static int nftnl_expr_reject_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_reject_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_reject *reject = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "type %u code %u ",
+	return snprintf(buf, size, "type %u code %u ",
 			reject->type, reject->icmp_code);
 }
 
@@ -161,18 +161,18 @@ static int nftnl_expr_reject_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_reject_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_reject_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_reject_snprintf_default(buf, len, e);
+		return nftnl_expr_reject_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_reject_export(buf, len, e, type);
+		return nftnl_expr_reject_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/rt.c +6 -6
index 10cb1e2..408b9a9 100644
@@ -173,13 +173,13 @@ static int nftnl_expr_rt_json_parse(struct nftnl_expr *e, json_t *root,
 }
 
 static int
-nftnl_expr_rt_snprintf_default(char *buf, size_t len,
+nftnl_expr_rt_snprintf_default(char *buf, size_t size,
 			       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_rt *rt = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_RT_DREG)) {
-		return snprintf(buf, len, "load %s => reg %u ",
+		return snprintf(buf, size, "load %s => reg %u ",
 				rt_key2str(rt->key), rt->dreg);
 	}
 	return 0;
@@ -200,18 +200,18 @@ static int nftnl_expr_rt_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_rt_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_rt_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_rt_snprintf_default(buf, len, e);
+		return nftnl_expr_rt_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_rt_export(buf, len, e, type);
+		return nftnl_expr_rt_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/target.c +4 -5
index 3c58b03..524b378 100644
@@ -195,21 +195,21 @@ static int nftnl_rule_exp_target_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_target_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_target_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_target *target = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return snprintf(buf, len, "name %s rev %u ",
+		return snprintf(buf, size, "name %s rev %u ",
 				target->name, target->rev);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_rule_exp_target_export(buf, len, e, type);
+		return nftnl_rule_exp_target_export(buf, size, e, type);
 	default:
 		break;
 	}
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20171004182138.GA24970%40meghana-HP-Pavilion-Notebook.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 10 lines · Julia Lawall
Quoted 3 lines · Meghana Madhyastha

Change the variable name from size_t len to
size_t size in the sprintf functions for
consistency.

It looks like a lot of changes. Is size_t size already used in a lot of other places?

size_t size is used in most of the other places (in more places than size_t len in other parts of the codebase) so Pablo had asked me to convert size_t len to size_t size.

Regards,
Meghana

Quoted 936 lines

Try to make log messages the use more of the horizontal space.

julia

Quoted 932 lines
---
 src/expr/counter.c   | 12 ++++++------
 src/expr/ct.c        |  8 ++++----
 src/expr/dup.c       | 16 ++++++++--------
 src/expr/exthdr.c    | 14 +++++++-------
 src/expr/fib.c       |  8 ++++----
 src/expr/fwd.c       | 12 ++++++------
 src/expr/hash.c      |  8 ++++----
 src/expr/immediate.c | 12 ++++++------
 src/expr/limit.c     | 12 ++++++------
 src/expr/log.c       |  8 ++++----
 src/expr/masq.c      | 14 +++++++-------
 src/expr/match.c     |  8 ++++----
 src/expr/meta.c      | 14 +++++++-------
 src/expr/numgen.c    |  8 ++++----
 src/expr/objref.c    | 14 +++++++-------
 src/expr/payload.c   | 10 +++++-----
 src/expr/queue.c     | 24 ++++++++++++------------
 src/expr/quota.c     | 12 ++++++------
 src/expr/redir.c     | 18 +++++++++---------
 src/expr/reject.c    | 12 ++++++------
 src/expr/rt.c        | 12 ++++++------
 src/expr/target.c    |  8 ++++----
 22 files changed, 132 insertions(+), 132 deletions(-)
src/expr/counter.c +6 -6
index 5c196d4..4de6b92 100644
@@ -151,28 +151,28 @@ static int nftnl_expr_counter_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_counter_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_counter_snprintf_default(char *buf, size_t size,
 					       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_counter *ctr = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "pkts %"PRIu64" bytes %"PRIu64" ",
+	return snprintf(buf, size, "pkts %"PRIu64" bytes %"PRIu64" ",
 			ctr->pkts, ctr->bytes);
 }
 
-static int nftnl_expr_counter_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_counter_snprintf(char *buf, size_t size, uint32_t type,
 				       uint32_t flags,
 				       const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_counter_snprintf_default(buf, len, e);
+		return nftnl_expr_counter_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_counter_export(buf, len, e, type);
+		return nftnl_expr_counter_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/ct.c +4 -4
index 021a277..396bee0 100644
@@ -314,18 +314,18 @@ nftnl_expr_ct_snprintf_default(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_ct_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_ct_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_ct_snprintf_default(buf, len, e);
+		return nftnl_expr_ct_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_ct_export(buf, len, e, type);
+		return nftnl_expr_ct_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/dup.c +8 -8
index e2171f4..f67331b 100644
@@ -147,38 +147,38 @@ static int nftnl_expr_dup_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_dup_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_dup_snprintf_default(char *buf, size_t size,
 					   const struct nftnl_expr *e,
 					   uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_dup *dup = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_DUP_SREG_ADDR)) {
-		ret = snprintf(buf + offset, len, "sreg_addr %u ", dup->sreg_addr);
+		ret = snprintf(buf + offset, size, "sreg_addr %u ", dup->sreg_addr);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_DUP_SREG_DEV)) {
-		ret = snprintf(buf + offset, len, "sreg_dev %u ", dup->sreg_dev);
+		ret = snprintf(buf + offset, size, "sreg_dev %u ", dup->sreg_dev);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	return offset;
 }
 
-static int nftnl_expr_dup_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_dup_snprintf(char *buf, size_t size, uint32_t type,
 				   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_dup_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_dup_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_dup_export(buf, len, e, type);
+		return nftnl_expr_dup_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/exthdr.c +7 -7
index 11766fa..12f49d8 100644
@@ -317,37 +317,37 @@ static int nftnl_expr_exthdr_export(char *buf, size_t len,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_exthdr_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_exthdr_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_exthdr *exthdr = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_EXTHDR_DREG))
-		return snprintf(buf, len, "load%s %ub @ %u + %u%s => reg %u ",
+		return snprintf(buf, size, "load%s %ub @ %u + %u%s => reg %u ",
 				op2str(exthdr->op), exthdr->len, exthdr->type,
 				exthdr->offset,
 				exthdr->flags & NFT_EXTHDR_F_PRESENT ? " present" : "",
 				exthdr->dreg);
 	else
-		return snprintf(buf, len, "write%s reg %u => %ub @ %u + %u ",
+		return snprintf(buf, size, "write%s reg %u => %ub @ %u + %u ",
 				op2str(exthdr->op), exthdr->sreg, exthdr->len, exthdr->type,
 				exthdr->offset);
 
 }
 
 static int
-nftnl_expr_exthdr_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_exthdr_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_exthdr_snprintf_default(buf, len, e);
+		return nftnl_expr_exthdr_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_exthdr_export(buf, len, e, type);
+		return nftnl_expr_exthdr_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/fib.c +4 -4
index cbadeef..cb62020 100644
@@ -233,18 +233,18 @@ static int nftnl_expr_fib_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_fib_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_fib_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_fib_snprintf_default(buf, len, e);
+		return nftnl_expr_fib_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_fib_export(buf, len, e, type);
+		return nftnl_expr_fib_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/fwd.c +6 -6
index 38923df..9b5e555 100644
@@ -128,11 +128,11 @@ static int nftnl_expr_fwd_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_fwd_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_fwd_snprintf_default(char *buf, size_t size,
 					   const struct nftnl_expr *e,
 					   uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_fwd *fwd = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_FWD_SREG_DEV)) {
@@ -144,18 +144,18 @@ static int nftnl_expr_fwd_snprintf_default(char *buf, size_t len,
 	return offset;
 }
 
-static int nftnl_expr_fwd_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_fwd_snprintf(char *buf, size_t size, uint32_t type,
 				   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_fwd_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_fwd_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_fwd_export(buf, len, e, type);
+		return nftnl_expr_fwd_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/hash.c +4 -4
index 066c790..6a52308 100644
@@ -285,18 +285,18 @@ static int nftnl_expr_hash_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_hash_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_hash_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_hash_snprintf_default(buf, len, e);
+		return nftnl_expr_hash_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_hash_export(buf, len, e, type);
+		return nftnl_expr_hash_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/immediate.c +6 -6
index aba84ea..5cdad03 100644
@@ -229,11 +229,11 @@ nftnl_expr_immediate_export(char *buf, size_t size, const struct nftnl_expr *e,
 }
 
 static int
-nftnl_expr_immediate_snprintf_default(char *buf, size_t len,
+nftnl_expr_immediate_snprintf_default(char *buf, size_t size,
 				      const struct nftnl_expr *e,
 				      uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_immediate *imm = nftnl_expr_data(e);
 
 	ret = snprintf(buf, remain, "reg %u ", imm->dreg);
@@ -259,18 +259,18 @@ nftnl_expr_immediate_snprintf_default(char *buf, size_t len,
 }
 
 static int
-nftnl_expr_immediate_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_immediate_snprintf(char *buf, size_t size, uint32_t type,
 			      uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_immediate_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_immediate_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_immediate_export(buf, len, e, type);
+		return nftnl_expr_immediate_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/limit.c +6 -6
index 8e1f02a..3927dbf 100644
@@ -229,29 +229,29 @@ static const char *limit_to_type(enum nft_limit_type type)
 	}
 }
 
-static int nftnl_expr_limit_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_limit_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
 	struct nftnl_expr_limit *limit = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "rate %"PRIu64"/%s burst %u type %s flags 0x%x ",
+	return snprintf(buf, size, "rate %"PRIu64"/%s burst %u type %s flags 0x%x ",
 			limit->rate, get_unit(limit->unit), limit->burst,
 			limit_to_type(limit->type), limit->flags);
 }
 
 static int
-nftnl_expr_limit_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_limit_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_limit_snprintf_default(buf, len, e);
+		return nftnl_expr_limit_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_limit_export(buf, len, e, type);
+		return nftnl_expr_limit_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/log.c +4 -4
index 161327b..48abc9c 100644
@@ -298,18 +298,18 @@ static int nftnl_expr_log_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_log_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_log_snprintf(char *buf, size_t size, uint32_t type,
 			uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_log_snprintf_default(buf, len, e);
+		return nftnl_expr_log_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_log_export(buf, len, e, type);
+		return nftnl_expr_log_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/masq.c +7 -7
index 1c75ee9..76d3eea 100644
@@ -171,15 +171,15 @@ static int nftnl_expr_masq_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_masq_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_masq_snprintf_default(char *buf, size_t size,
 					    const struct nftnl_expr *e)
 {
 	struct nftnl_expr_masq *masq = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_MASQ_FLAGS))
-		return snprintf(buf, len, "flags 0x%x ", masq->flags);
+		return snprintf(buf, size, "flags 0x%x ", masq->flags);
 	if (e->flags & (1 << NFTNL_EXPR_MASQ_REG_PROTO_MIN)) {
-		return snprintf(buf, len,
+		return snprintf(buf, size,
 				"proto_min reg %u proto_max reg %u ",
 				masq->sreg_proto_min, masq->sreg_proto_max);
 	}
@@ -187,18 +187,18 @@ static int nftnl_expr_masq_snprintf_default(char *buf, size_t len,
 	return 0;
 }
 
-static int nftnl_expr_masq_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_masq_snprintf(char *buf, size_t size, uint32_t type,
 				    uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_masq_snprintf_default(buf, len, e);
+		return nftnl_expr_masq_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_masq_export(buf, len, e, type);
+		return nftnl_expr_masq_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/match.c +4 -4
index af659b3..431c339 100644
@@ -195,21 +195,21 @@ static int nftnl_expr_match_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_match_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_match_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_match *match = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return snprintf(buf, len, "name %s rev %u ",
+		return snprintf(buf, size, "name %s rev %u ",
 				match->name, match->rev);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_match_export(buf, len, e, type);
+		return nftnl_expr_match_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/meta.c +7 -7
index b5c27e6..95e84ad 100644
@@ -216,17 +216,17 @@ static int nftnl_expr_meta_json_parse(struct nftnl_expr *e, json_t *root,
 }
 
 static int
-nftnl_expr_meta_snprintf_default(char *buf, size_t len,
+nftnl_expr_meta_snprintf_default(char *buf, size_t size,
 				 const struct nftnl_expr *e)
 {
 	struct nftnl_expr_meta *meta = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_META_SREG)) {
-		return snprintf(buf, len, "set %s with reg %u ",
+		return snprintf(buf, size, "set %s with reg %u ",
 				meta_key2str(meta->key), meta->sreg);
 	}
 	if (e->flags & (1 << NFTNL_EXPR_META_DREG)) {
-		return snprintf(buf, len, "load %s => reg %u ",
+		return snprintf(buf, size, "load %s => reg %u ",
 				meta_key2str(meta->key), meta->dreg);
 	}
 	return 0;
@@ -249,18 +249,18 @@ static int nftnl_expr_meta_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_meta_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_meta_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_meta_snprintf_default(buf, len, e);
+		return nftnl_expr_meta_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_meta_export(buf, len, e, type);
+		return nftnl_expr_meta_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/numgen.c +4 -4
index 9b5b1b7..83c493a 100644
@@ -221,18 +221,18 @@ static int nftnl_expr_ng_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_ng_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_ng_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_ng_snprintf_default(buf, len, e);
+		return nftnl_expr_ng_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_ng_export(buf, len, e, type);
+		return nftnl_expr_ng_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/objref.c +7 -7
index b4b3383..340dc67 100644
@@ -219,32 +219,32 @@ static int nftnl_expr_objref_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_objref_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_objref_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_objref *objref = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_OBJREF_SET_SREG))
-		return snprintf(buf, len, "sreg %u set %s id %u ",
+		return snprintf(buf, size, "sreg %u set %s id %u ",
 				objref->set.sreg, objref->set.name, objref->set.id);
 	else
-		return snprintf(buf, len, "type %u name %s ",
+		return snprintf(buf, size, "type %u name %s ",
 				objref->imm.type, objref->imm.name);
 }
 
-static int nftnl_expr_objref_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_objref_snprintf(char *buf, size_t size, uint32_t type,
 				      uint32_t flags,
 				      const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_objref_snprintf_default(buf, len, e);
+		return nftnl_expr_objref_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_objref_export(buf, len, e, type);
+		return nftnl_expr_objref_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/payload.c +5 -5
index 897fc77..d61e854 100644
@@ -285,30 +285,30 @@ static int nftnl_expr_payload_export(char *buf, size_t size, uint32_t flags,
 }
 
 static int
-nftnl_expr_payload_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_payload_snprintf(char *buf, size_t size, uint32_t type,
 			    uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_payload *payload = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
 		if (payload->sreg)
-			return snprintf(buf, len, "write reg %u => %ub @ %s header + %u csum_type %u csum_off %u csum_flags 0x%x ",
+			return snprintf(buf, size, "write reg %u => %ub @ %s header + %u csum_type %u csum_off %u csum_flags 0x%x ",
 					payload->sreg,
 					payload->len, base2str(payload->base),
 					payload->offset, payload->csum_type,
 					payload->csum_offset,
 					payload->csum_flags);
 		else
-			return snprintf(buf, len, "load %ub @ %s header + %u => reg %u ",
+			return snprintf(buf, size, "load %ub @ %s header + %u => reg %u ",
 					payload->len, base2str(payload->base),
 					payload->offset, payload->dreg);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_payload_export(buf, len, flags, e, type);
+		return nftnl_expr_payload_export(buf, size, flags, e, type);
 	default:
 		break;
 	}
src/expr/queue.c +12 -12
index e0fb785..acb42e9 100644
@@ -172,41 +172,41 @@ nftnl_expr_queue_json_parse(struct nftnl_expr *e, json_t *root,
 #endif
 }
 
-static int nftnl_expr_queue_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_queue_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
 	struct nftnl_expr_queue *queue = nftnl_expr_data(e);
-	int ret, remain = len, offset = 0;
+	int ret, remain = size, offset = 0;
 	uint16_t total_queues;
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_NUM)) {
 		total_queues = queue->queuenum + queue->queues_total - 1;
 
-		ret = snprintf(buf + offset, len, "num %u", queue->queuenum);
+		ret = snprintf(buf + offset, size, "num %u", queue->queuenum);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 
 		if (queue->queues_total && total_queues != queue->queuenum) {
-			ret = snprintf(buf + offset, len, "-%u", total_queues);
+			ret = snprintf(buf + offset, size, "-%u", total_queues);
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 
-		ret = snprintf(buf + offset, len, " ");
+		ret = snprintf(buf + offset, size, " ");
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_SREG_QNUM)) {
-		ret = snprintf(buf + offset, len, "sreg_qnum %u ",
+		ret = snprintf(buf + offset, size, "sreg_qnum %u ",
 			       queue->sreg_qnum);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_FLAGS)) {
 		if (queue->flags & (NFT_QUEUE_FLAG_BYPASS)) {
-			ret = snprintf(buf + offset, len, "bypass ");
+			ret = snprintf(buf + offset, size, "bypass ");
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 		if (queue->flags & (NFT_QUEUE_FLAG_CPU_FANOUT)) {
-			ret = snprintf(buf + offset, len, "fanout ");
+			ret = snprintf(buf + offset, size, "fanout ");
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 	}
@@ -232,18 +232,18 @@ static int nftnl_expr_queue_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_queue_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_queue_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_queue_snprintf_default(buf, len, e);
+		return nftnl_expr_queue_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_queue_export(buf, len, e, type);
+		return nftnl_expr_queue_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/quota.c +6 -6
index c247b0a..e9cc708 100644
@@ -169,29 +169,29 @@ static int nftnl_expr_quota_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_quota_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_quota_snprintf_default(char *buf, size_t size,
 					       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_quota *quota = nftnl_expr_data(e);
 
-	return snprintf(buf, len,
+	return snprintf(buf, size,
 			"bytes %"PRIu64" consumed %"PRIu64" flags %u ",
 			quota->bytes, quota->consumed, quota->flags);
 }
 
-static int nftnl_expr_quota_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_quota_snprintf(char *buf, size_t size, uint32_t type,
 				       uint32_t flags,
 				       const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_quota_snprintf_default(buf, len, e);
+		return nftnl_expr_quota_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_quota_export(buf, len, e, type);
+		return nftnl_expr_quota_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/redir.c +9 -9
index 9fb634a..b58635c 100644
@@ -173,26 +173,26 @@ static int nftnl_expr_redir_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_redir_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_redir_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
-	int ret, remain = len, offset = 0;
+	int ret, remain = size, 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 ",
+		ret = snprintf(buf + offset, size, "proto_min reg %u ",
 			       redir->sreg_proto_min);
 		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 ",
+		ret = snprintf(buf + offset, size, "proto_max reg %u ",
 			       redir->sreg_proto_max);
 		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, size, "flags 0x%x ",
 			       redir->flags);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
@@ -201,18 +201,18 @@ static int nftnl_expr_redir_snprintf_default(char *buf, size_t len,
 }
 
 static int
-nftnl_expr_redir_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_redir_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_redir_snprintf_default(buf, len, e);
+		return nftnl_expr_redir_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_redir_export(buf, len, e, type);
+		return nftnl_expr_redir_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/reject.c +6 -6
index 1e6fdf5..01bafb4 100644
@@ -137,12 +137,12 @@ nftnl_expr_reject_json_parse(struct nftnl_expr *e, json_t *root,
 #endif
 }
 
-static int nftnl_expr_reject_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_reject_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_reject *reject = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "type %u code %u ",
+	return snprintf(buf, size, "type %u code %u ",
 			reject->type, reject->icmp_code);
 }
 
@@ -161,18 +161,18 @@ static int nftnl_expr_reject_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_reject_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_reject_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_reject_snprintf_default(buf, len, e);
+		return nftnl_expr_reject_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_reject_export(buf, len, e, type);
+		return nftnl_expr_reject_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/rt.c +6 -6
index 10cb1e2..408b9a9 100644
@@ -173,13 +173,13 @@ static int nftnl_expr_rt_json_parse(struct nftnl_expr *e, json_t *root,
 }
 
 static int
-nftnl_expr_rt_snprintf_default(char *buf, size_t len,
+nftnl_expr_rt_snprintf_default(char *buf, size_t size,
 			       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_rt *rt = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_RT_DREG)) {
-		return snprintf(buf, len, "load %s => reg %u ",
+		return snprintf(buf, size, "load %s => reg %u ",
 				rt_key2str(rt->key), rt->dreg);
 	}
 	return 0;
@@ -200,18 +200,18 @@ static int nftnl_expr_rt_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_rt_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_rt_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_rt_snprintf_default(buf, len, e);
+		return nftnl_expr_rt_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_rt_export(buf, len, e, type);
+		return nftnl_expr_rt_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/target.c +4 -5
index 3c58b03..524b378 100644
@@ -195,21 +195,21 @@ static int nftnl_rule_exp_target_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_target_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_target_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_target *target = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return snprintf(buf, len, "name %s rev %u ",
+		return snprintf(buf, size, "name %s rev %u ",
 				target->name, target->rev);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_rule_exp_target_export(buf, len, e, type);
+		return nftnl_rule_exp_target_export(buf, size, e, type);
 	default:
 		break;
 	}
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20171004182138.GA24970%40meghana-HP-Pavilion-Notebook.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
Quoted 9 lines · Meghana Madhyastha
Quoted 8 lines · Julia Lawall
Quoted 3 lines · Meghana Madhyastha

Change the variable name from size_t len to
size_t size in the sprintf functions for
consistency.

Quoted 6 lines
Quoted 2 lines

It looks like a lot of changes. Is size_t size already used in a lot of other places?

size_t size is used in most of the other places (in more places than size_t len in other parts of the codebase) so Pablo had asked me to convert size_t len to size_t size.

OK.

julia

Quoted 948 lines

Regards,
Meghana

Quoted 929 lines

Try to make log messages the use more of the horizontal space.

julia

Quoted 925 lines
---
 src/expr/counter.c   | 12 ++++++------
 src/expr/ct.c        |  8 ++++----
 src/expr/dup.c       | 16 ++++++++--------
 src/expr/exthdr.c    | 14 +++++++-------
 src/expr/fib.c       |  8 ++++----
 src/expr/fwd.c       | 12 ++++++------
 src/expr/hash.c      |  8 ++++----
 src/expr/immediate.c | 12 ++++++------
 src/expr/limit.c     | 12 ++++++------
 src/expr/log.c       |  8 ++++----
 src/expr/masq.c      | 14 +++++++-------
 src/expr/match.c     |  8 ++++----
 src/expr/meta.c      | 14 +++++++-------
 src/expr/numgen.c    |  8 ++++----
 src/expr/objref.c    | 14 +++++++-------
 src/expr/payload.c   | 10 +++++-----
 src/expr/queue.c     | 24 ++++++++++++------------
 src/expr/quota.c     | 12 ++++++------
 src/expr/redir.c     | 18 +++++++++---------
 src/expr/reject.c    | 12 ++++++------
 src/expr/rt.c        | 12 ++++++------
 src/expr/target.c    |  8 ++++----
 22 files changed, 132 insertions(+), 132 deletions(-)
src/expr/counter.c +6 -6
index 5c196d4..4de6b92 100644
@@ -151,28 +151,28 @@ static int nftnl_expr_counter_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_counter_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_counter_snprintf_default(char *buf, size_t size,
 					       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_counter *ctr = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "pkts %"PRIu64" bytes %"PRIu64" ",
+	return snprintf(buf, size, "pkts %"PRIu64" bytes %"PRIu64" ",
 			ctr->pkts, ctr->bytes);
 }
 
-static int nftnl_expr_counter_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_counter_snprintf(char *buf, size_t size, uint32_t type,
 				       uint32_t flags,
 				       const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_counter_snprintf_default(buf, len, e);
+		return nftnl_expr_counter_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_counter_export(buf, len, e, type);
+		return nftnl_expr_counter_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/ct.c +4 -4
index 021a277..396bee0 100644
@@ -314,18 +314,18 @@ nftnl_expr_ct_snprintf_default(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_ct_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_ct_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_ct_snprintf_default(buf, len, e);
+		return nftnl_expr_ct_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_ct_export(buf, len, e, type);
+		return nftnl_expr_ct_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/dup.c +8 -8
index e2171f4..f67331b 100644
@@ -147,38 +147,38 @@ static int nftnl_expr_dup_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_dup_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_dup_snprintf_default(char *buf, size_t size,
 					   const struct nftnl_expr *e,
 					   uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_dup *dup = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_DUP_SREG_ADDR)) {
-		ret = snprintf(buf + offset, len, "sreg_addr %u ", dup->sreg_addr);
+		ret = snprintf(buf + offset, size, "sreg_addr %u ", dup->sreg_addr);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_DUP_SREG_DEV)) {
-		ret = snprintf(buf + offset, len, "sreg_dev %u ", dup->sreg_dev);
+		ret = snprintf(buf + offset, size, "sreg_dev %u ", dup->sreg_dev);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	return offset;
 }
 
-static int nftnl_expr_dup_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_dup_snprintf(char *buf, size_t size, uint32_t type,
 				   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_dup_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_dup_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_dup_export(buf, len, e, type);
+		return nftnl_expr_dup_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/exthdr.c +7 -7
index 11766fa..12f49d8 100644
@@ -317,37 +317,37 @@ static int nftnl_expr_exthdr_export(char *buf, size_t len,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_exthdr_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_exthdr_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_exthdr *exthdr = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_EXTHDR_DREG))
-		return snprintf(buf, len, "load%s %ub @ %u + %u%s => reg %u ",
+		return snprintf(buf, size, "load%s %ub @ %u + %u%s => reg %u ",
 				op2str(exthdr->op), exthdr->len, exthdr->type,
 				exthdr->offset,
 				exthdr->flags & NFT_EXTHDR_F_PRESENT ? " present" : "",
 				exthdr->dreg);
 	else
-		return snprintf(buf, len, "write%s reg %u => %ub @ %u + %u ",
+		return snprintf(buf, size, "write%s reg %u => %ub @ %u + %u ",
 				op2str(exthdr->op), exthdr->sreg, exthdr->len, exthdr->type,
 				exthdr->offset);
 
 }
 
 static int
-nftnl_expr_exthdr_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_exthdr_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_exthdr_snprintf_default(buf, len, e);
+		return nftnl_expr_exthdr_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_exthdr_export(buf, len, e, type);
+		return nftnl_expr_exthdr_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/fib.c +4 -4
index cbadeef..cb62020 100644
@@ -233,18 +233,18 @@ static int nftnl_expr_fib_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_fib_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_fib_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_fib_snprintf_default(buf, len, e);
+		return nftnl_expr_fib_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_fib_export(buf, len, e, type);
+		return nftnl_expr_fib_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/fwd.c +6 -6
index 38923df..9b5e555 100644
@@ -128,11 +128,11 @@ static int nftnl_expr_fwd_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_fwd_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_fwd_snprintf_default(char *buf, size_t size,
 					   const struct nftnl_expr *e,
 					   uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_fwd *fwd = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_FWD_SREG_DEV)) {
@@ -144,18 +144,18 @@ static int nftnl_expr_fwd_snprintf_default(char *buf, size_t len,
 	return offset;
 }
 
-static int nftnl_expr_fwd_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_fwd_snprintf(char *buf, size_t size, uint32_t type,
 				   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_fwd_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_fwd_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_fwd_export(buf, len, e, type);
+		return nftnl_expr_fwd_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/hash.c +4 -4
index 066c790..6a52308 100644
@@ -285,18 +285,18 @@ static int nftnl_expr_hash_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_hash_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_hash_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_hash_snprintf_default(buf, len, e);
+		return nftnl_expr_hash_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_hash_export(buf, len, e, type);
+		return nftnl_expr_hash_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/immediate.c +6 -6
index aba84ea..5cdad03 100644
@@ -229,11 +229,11 @@ nftnl_expr_immediate_export(char *buf, size_t size, const struct nftnl_expr *e,
 }
 
 static int
-nftnl_expr_immediate_snprintf_default(char *buf, size_t len,
+nftnl_expr_immediate_snprintf_default(char *buf, size_t size,
 				      const struct nftnl_expr *e,
 				      uint32_t flags)
 {
-	int remain = len, offset = 0, ret;
+	int remain = size, offset = 0, ret;
 	struct nftnl_expr_immediate *imm = nftnl_expr_data(e);
 
 	ret = snprintf(buf, remain, "reg %u ", imm->dreg);
@@ -259,18 +259,18 @@ nftnl_expr_immediate_snprintf_default(char *buf, size_t len,
 }
 
 static int
-nftnl_expr_immediate_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_immediate_snprintf(char *buf, size_t size, uint32_t type,
 			      uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_immediate_snprintf_default(buf, len, e, flags);
+		return nftnl_expr_immediate_snprintf_default(buf, size, e, flags);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_immediate_export(buf, len, e, type);
+		return nftnl_expr_immediate_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/limit.c +6 -6
index 8e1f02a..3927dbf 100644
@@ -229,29 +229,29 @@ static const char *limit_to_type(enum nft_limit_type type)
 	}
 }
 
-static int nftnl_expr_limit_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_limit_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
 	struct nftnl_expr_limit *limit = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "rate %"PRIu64"/%s burst %u type %s flags 0x%x ",
+	return snprintf(buf, size, "rate %"PRIu64"/%s burst %u type %s flags 0x%x ",
 			limit->rate, get_unit(limit->unit), limit->burst,
 			limit_to_type(limit->type), limit->flags);
 }
 
 static int
-nftnl_expr_limit_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_limit_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_limit_snprintf_default(buf, len, e);
+		return nftnl_expr_limit_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_limit_export(buf, len, e, type);
+		return nftnl_expr_limit_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/log.c +4 -4
index 161327b..48abc9c 100644
@@ -298,18 +298,18 @@ static int nftnl_expr_log_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_log_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_log_snprintf(char *buf, size_t size, uint32_t type,
 			uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch(type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_log_snprintf_default(buf, len, e);
+		return nftnl_expr_log_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_log_export(buf, len, e, type);
+		return nftnl_expr_log_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/masq.c +7 -7
index 1c75ee9..76d3eea 100644
@@ -171,15 +171,15 @@ static int nftnl_expr_masq_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_masq_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_masq_snprintf_default(char *buf, size_t size,
 					    const struct nftnl_expr *e)
 {
 	struct nftnl_expr_masq *masq = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_MASQ_FLAGS))
-		return snprintf(buf, len, "flags 0x%x ", masq->flags);
+		return snprintf(buf, size, "flags 0x%x ", masq->flags);
 	if (e->flags & (1 << NFTNL_EXPR_MASQ_REG_PROTO_MIN)) {
-		return snprintf(buf, len,
+		return snprintf(buf, size,
 				"proto_min reg %u proto_max reg %u ",
 				masq->sreg_proto_min, masq->sreg_proto_max);
 	}
@@ -187,18 +187,18 @@ static int nftnl_expr_masq_snprintf_default(char *buf, size_t len,
 	return 0;
 }
 
-static int nftnl_expr_masq_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_masq_snprintf(char *buf, size_t size, uint32_t type,
 				    uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_masq_snprintf_default(buf, len, e);
+		return nftnl_expr_masq_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_masq_export(buf, len, e, type);
+		return nftnl_expr_masq_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/match.c +4 -4
index af659b3..431c339 100644
@@ -195,21 +195,21 @@ static int nftnl_expr_match_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_match_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_match_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_match *match = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return snprintf(buf, len, "name %s rev %u ",
+		return snprintf(buf, size, "name %s rev %u ",
 				match->name, match->rev);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_match_export(buf, len, e, type);
+		return nftnl_expr_match_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/meta.c +7 -7
index b5c27e6..95e84ad 100644
@@ -216,17 +216,17 @@ static int nftnl_expr_meta_json_parse(struct nftnl_expr *e, json_t *root,
 }
 
 static int
-nftnl_expr_meta_snprintf_default(char *buf, size_t len,
+nftnl_expr_meta_snprintf_default(char *buf, size_t size,
 				 const struct nftnl_expr *e)
 {
 	struct nftnl_expr_meta *meta = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_META_SREG)) {
-		return snprintf(buf, len, "set %s with reg %u ",
+		return snprintf(buf, size, "set %s with reg %u ",
 				meta_key2str(meta->key), meta->sreg);
 	}
 	if (e->flags & (1 << NFTNL_EXPR_META_DREG)) {
-		return snprintf(buf, len, "load %s => reg %u ",
+		return snprintf(buf, size, "load %s => reg %u ",
 				meta_key2str(meta->key), meta->dreg);
 	}
 	return 0;
@@ -249,18 +249,18 @@ static int nftnl_expr_meta_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_meta_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_meta_snprintf(char *buf, size_t size, uint32_t type,
 			 uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_meta_snprintf_default(buf, len, e);
+		return nftnl_expr_meta_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_meta_export(buf, len, e, type);
+		return nftnl_expr_meta_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/numgen.c +4 -4
index 9b5b1b7..83c493a 100644
@@ -221,18 +221,18 @@ static int nftnl_expr_ng_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_ng_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_ng_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_ng_snprintf_default(buf, len, e);
+		return nftnl_expr_ng_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_ng_export(buf, len, e, type);
+		return nftnl_expr_ng_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/objref.c +7 -7
index b4b3383..340dc67 100644
@@ -219,32 +219,32 @@ static int nftnl_expr_objref_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_objref_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_objref_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_objref *objref = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_OBJREF_SET_SREG))
-		return snprintf(buf, len, "sreg %u set %s id %u ",
+		return snprintf(buf, size, "sreg %u set %s id %u ",
 				objref->set.sreg, objref->set.name, objref->set.id);
 	else
-		return snprintf(buf, len, "type %u name %s ",
+		return snprintf(buf, size, "type %u name %s ",
 				objref->imm.type, objref->imm.name);
 }
 
-static int nftnl_expr_objref_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_objref_snprintf(char *buf, size_t size, uint32_t type,
 				      uint32_t flags,
 				      const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_objref_snprintf_default(buf, len, e);
+		return nftnl_expr_objref_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_objref_export(buf, len, e, type);
+		return nftnl_expr_objref_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/payload.c +5 -5
index 897fc77..d61e854 100644
@@ -285,30 +285,30 @@ static int nftnl_expr_payload_export(char *buf, size_t size, uint32_t flags,
 }
 
 static int
-nftnl_expr_payload_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_payload_snprintf(char *buf, size_t size, uint32_t type,
 			    uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_payload *payload = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
 		if (payload->sreg)
-			return snprintf(buf, len, "write reg %u => %ub @ %s header + %u csum_type %u csum_off %u csum_flags 0x%x ",
+			return snprintf(buf, size, "write reg %u => %ub @ %s header + %u csum_type %u csum_off %u csum_flags 0x%x ",
 					payload->sreg,
 					payload->len, base2str(payload->base),
 					payload->offset, payload->csum_type,
 					payload->csum_offset,
 					payload->csum_flags);
 		else
-			return snprintf(buf, len, "load %ub @ %s header + %u => reg %u ",
+			return snprintf(buf, size, "load %ub @ %s header + %u => reg %u ",
 					payload->len, base2str(payload->base),
 					payload->offset, payload->dreg);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_payload_export(buf, len, flags, e, type);
+		return nftnl_expr_payload_export(buf, size, flags, e, type);
 	default:
 		break;
 	}
src/expr/queue.c +12 -12
index e0fb785..acb42e9 100644
@@ -172,41 +172,41 @@ nftnl_expr_queue_json_parse(struct nftnl_expr *e, json_t *root,
 #endif
 }
 
-static int nftnl_expr_queue_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_queue_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
 	struct nftnl_expr_queue *queue = nftnl_expr_data(e);
-	int ret, remain = len, offset = 0;
+	int ret, remain = size, offset = 0;
 	uint16_t total_queues;
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_NUM)) {
 		total_queues = queue->queuenum + queue->queues_total - 1;
 
-		ret = snprintf(buf + offset, len, "num %u", queue->queuenum);
+		ret = snprintf(buf + offset, size, "num %u", queue->queuenum);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 
 		if (queue->queues_total && total_queues != queue->queuenum) {
-			ret = snprintf(buf + offset, len, "-%u", total_queues);
+			ret = snprintf(buf + offset, size, "-%u", total_queues);
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 
-		ret = snprintf(buf + offset, len, " ");
+		ret = snprintf(buf + offset, size, " ");
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_SREG_QNUM)) {
-		ret = snprintf(buf + offset, len, "sreg_qnum %u ",
+		ret = snprintf(buf + offset, size, "sreg_qnum %u ",
 			       queue->sreg_qnum);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
 
 	if (e->flags & (1 << NFTNL_EXPR_QUEUE_FLAGS)) {
 		if (queue->flags & (NFT_QUEUE_FLAG_BYPASS)) {
-			ret = snprintf(buf + offset, len, "bypass ");
+			ret = snprintf(buf + offset, size, "bypass ");
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 		if (queue->flags & (NFT_QUEUE_FLAG_CPU_FANOUT)) {
-			ret = snprintf(buf + offset, len, "fanout ");
+			ret = snprintf(buf + offset, size, "fanout ");
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 	}
@@ -232,18 +232,18 @@ static int nftnl_expr_queue_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_queue_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_queue_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_queue_snprintf_default(buf, len, e);
+		return nftnl_expr_queue_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_queue_export(buf, len, e, type);
+		return nftnl_expr_queue_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/quota.c +6 -6
index c247b0a..e9cc708 100644
@@ -169,29 +169,29 @@ static int nftnl_expr_quota_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_quota_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_quota_snprintf_default(char *buf, size_t size,
 					       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_quota *quota = nftnl_expr_data(e);
 
-	return snprintf(buf, len,
+	return snprintf(buf, size,
 			"bytes %"PRIu64" consumed %"PRIu64" flags %u ",
 			quota->bytes, quota->consumed, quota->flags);
 }
 
-static int nftnl_expr_quota_snprintf(char *buf, size_t len, uint32_t type,
+static int nftnl_expr_quota_snprintf(char *buf, size_t size, uint32_t type,
 				       uint32_t flags,
 				       const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_quota_snprintf_default(buf, len, e);
+		return nftnl_expr_quota_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_quota_export(buf, len, e, type);
+		return nftnl_expr_quota_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/redir.c +9 -9
index 9fb634a..b58635c 100644
@@ -173,26 +173,26 @@ static int nftnl_expr_redir_export(char *buf, size_t size,
 	return nftnl_buf_done(&b);
 }
 
-static int nftnl_expr_redir_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_redir_snprintf_default(char *buf, size_t size,
 					     const struct nftnl_expr *e)
 {
-	int ret, remain = len, offset = 0;
+	int ret, remain = size, 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 ",
+		ret = snprintf(buf + offset, size, "proto_min reg %u ",
 			       redir->sreg_proto_min);
 		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 ",
+		ret = snprintf(buf + offset, size, "proto_max reg %u ",
 			       redir->sreg_proto_max);
 		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, size, "flags 0x%x ",
 			       redir->flags);
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 	}
@@ -201,18 +201,18 @@ static int nftnl_expr_redir_snprintf_default(char *buf, size_t len,
 }
 
 static int
-nftnl_expr_redir_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_redir_snprintf(char *buf, size_t size, uint32_t type,
 			  uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_redir_snprintf_default(buf, len, e);
+		return nftnl_expr_redir_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_redir_export(buf, len, e, type);
+		return nftnl_expr_redir_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/reject.c +6 -6
index 1e6fdf5..01bafb4 100644
@@ -137,12 +137,12 @@ nftnl_expr_reject_json_parse(struct nftnl_expr *e, json_t *root,
 #endif
 }
 
-static int nftnl_expr_reject_snprintf_default(char *buf, size_t len,
+static int nftnl_expr_reject_snprintf_default(char *buf, size_t size,
 					      const struct nftnl_expr *e)
 {
 	struct nftnl_expr_reject *reject = nftnl_expr_data(e);
 
-	return snprintf(buf, len, "type %u code %u ",
+	return snprintf(buf, size, "type %u code %u ",
 			reject->type, reject->icmp_code);
 }
 
@@ -161,18 +161,18 @@ static int nftnl_expr_reject_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_reject_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_reject_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_reject_snprintf_default(buf, len, e);
+		return nftnl_expr_reject_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_reject_export(buf, len, e, type);
+		return nftnl_expr_reject_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/rt.c +6 -6
index 10cb1e2..408b9a9 100644
@@ -173,13 +173,13 @@ static int nftnl_expr_rt_json_parse(struct nftnl_expr *e, json_t *root,
 }
 
 static int
-nftnl_expr_rt_snprintf_default(char *buf, size_t len,
+nftnl_expr_rt_snprintf_default(char *buf, size_t size,
 			       const struct nftnl_expr *e)
 {
 	struct nftnl_expr_rt *rt = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_RT_DREG)) {
-		return snprintf(buf, len, "load %s => reg %u ",
+		return snprintf(buf, size, "load %s => reg %u ",
 				rt_key2str(rt->key), rt->dreg);
 	}
 	return 0;
@@ -200,18 +200,18 @@ static int nftnl_expr_rt_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_rt_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_rt_snprintf(char *buf, size_t size, uint32_t type,
 		       uint32_t flags, const struct nftnl_expr *e)
 {
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return nftnl_expr_rt_snprintf_default(buf, len, e);
+		return nftnl_expr_rt_snprintf_default(buf, size, e);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_expr_rt_export(buf, len, e, type);
+		return nftnl_expr_rt_export(buf, size, e, type);
 	default:
 		break;
 	}
src/expr/target.c +4 -5
index 3c58b03..524b378 100644
@@ -195,21 +195,21 @@ static int nftnl_rule_exp_target_export(char *buf, size_t size,
 }
 
 static int
-nftnl_expr_target_snprintf(char *buf, size_t len, uint32_t type,
+nftnl_expr_target_snprintf(char *buf, size_t size, uint32_t type,
 			   uint32_t flags, const struct nftnl_expr *e)
 {
 	struct nftnl_expr_target *target = nftnl_expr_data(e);
 
-	if (len)
+	if (size)
 		buf[0] = '\0';
 
 	switch (type) {
 	case NFTNL_OUTPUT_DEFAULT:
-		return snprintf(buf, len, "name %s rev %u ",
+		return snprintf(buf, size, "name %s rev %u ",
 				target->name, target->rev);
 	case NFTNL_OUTPUT_XML:
 	case NFTNL_OUTPUT_JSON:
-		return nftnl_rule_exp_target_export(buf, len, e, type);
+		return nftnl_rule_exp_target_export(buf, size, e, type);
 	default:
 		break;
 	}
--

2.7.4

Quoted 7 lines
Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20171004182138.GA24970%40meghana-HP-Pavilion-Notebook.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20171005032543.GA28390%40meghana-HP-Pavilion-Notebook.
For more options, visit https://groups.google.com/d/optout.