@@ -257,9 +257,6 @@ static int
nftnl_expr_bitwise_snprintf(char *buf, size_t size, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (size)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_bitwise_snprintf_default(buf, size, e);
@@ -272,9 +272,6 @@ static int
nftnl_expr_byteorder_snprintf(char *buf, size_t size, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (size)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_byteorder_snprintf_default(buf, size, e);
@@ -246,9 +246,6 @@ static int
nftnl_expr_cmp_snprintf(char *buf, size_t size, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (size)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_cmp_snprintf_default(buf, size, e);
@@ -164,9 +164,6 @@ static int nftnl_expr_counter_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags,
const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_counter_snprintf_default(buf, len, e);
@@ -317,9 +317,6 @@ static int
nftnl_expr_ct_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_ct_snprintf_default(buf, len, e);
@@ -170,9 +170,6 @@ static int nftnl_expr_dup_snprintf_default(char *buf, size_t len,
static int nftnl_expr_dup_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_dup_snprintf_default(buf, len, e, flags);
@@ -314,9 +314,6 @@ static int
nftnl_expr_dynset_snprintf(char *buf, size_t size, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (size)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_dynset_snprintf_default(buf, size, e);
@@ -339,9 +339,6 @@ static int
nftnl_expr_exthdr_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_exthdr_snprintf_default(buf, len, e);
@@ -236,9 +236,6 @@ static int
nftnl_expr_fib_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_fib_snprintf_default(buf, len, e);
@@ -147,9 +147,6 @@ static int nftnl_expr_fwd_snprintf_default(char *buf, size_t len,
static int nftnl_expr_fwd_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_fwd_snprintf_default(buf, len, e, flags);
@@ -288,9 +288,6 @@ static int
nftnl_expr_hash_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_hash_snprintf_default(buf, len, e);
@@ -262,9 +262,6 @@ static int
nftnl_expr_immediate_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch(type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_immediate_snprintf_default(buf, len, e, flags);
@@ -243,9 +243,6 @@ static int
nftnl_expr_limit_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch(type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_limit_snprintf_default(buf, len, e);
@@ -301,9 +301,6 @@ static int
nftnl_expr_log_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch(type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_log_snprintf_default(buf, len, e);
@@ -242,9 +242,6 @@ static int
nftnl_expr_lookup_snprintf(char *buf, size_t size, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (size)
- buf[0] = '\0';
-
switch(type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_lookup_snprintf_default(buf, size, e);
@@ -190,9 +190,6 @@ static int nftnl_expr_masq_snprintf_default(char *buf, size_t len,
static int nftnl_expr_masq_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_masq_snprintf_default(buf, len, e);
@@ -200,9 +200,6 @@ nftnl_expr_match_snprintf(char *buf, size_t len, uint32_t type,
{
struct nftnl_expr_match *match = nftnl_expr_data(e);
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return snprintf(buf, len, "name %s rev %u ",
@@ -252,9 +252,6 @@ static int
nftnl_expr_meta_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_meta_snprintf_default(buf, len, e);
@@ -339,9 +339,6 @@ static int
nftnl_expr_nat_snprintf(char *buf, size_t size, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (size)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_nat_snprintf_default(buf, size, e);
@@ -224,9 +224,6 @@ static int
nftnl_expr_ng_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_ng_snprintf_default(buf, len, e);
@@ -236,9 +236,6 @@ static int nftnl_expr_objref_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags,
const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_objref_snprintf_default(buf, len, e);
@@ -290,9 +290,6 @@ nftnl_expr_payload_snprintf(char *buf, size_t len, uint32_t type,
{
struct nftnl_expr_payload *payload = nftnl_expr_data(e);
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
if (payload->sreg)
@@ -235,9 +235,6 @@ static int
nftnl_expr_queue_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_queue_snprintf_default(buf, len, e);
@@ -183,9 +183,6 @@ static int nftnl_expr_quota_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags,
const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_quota_snprintf_default(buf, len, e);
@@ -263,9 +263,6 @@ static int nftnl_expr_range_snprintf_default(char *buf, size_t size,
static int nftnl_expr_range_snprintf(char *buf, size_t size, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (size)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_range_snprintf_default(buf, size, e);
@@ -204,9 +204,6 @@ static int
nftnl_expr_redir_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_redir_snprintf_default(buf, len, e);
@@ -164,9 +164,6 @@ static int
nftnl_expr_reject_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_reject_snprintf_default(buf, len, e);
@@ -203,9 +203,6 @@ static int
nftnl_expr_rt_snprintf(char *buf, size_t len, uint32_t type,
uint32_t flags, const struct nftnl_expr *e)
{
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return nftnl_expr_rt_snprintf_default(buf, len, e);
@@ -200,9 +200,6 @@ nftnl_expr_target_snprintf(char *buf, size_t len, uint32_t type,
{
struct nftnl_expr_target *target = nftnl_expr_data(e);
- if (len)
- buf[0] = '\0';
-
switch (type) {
case NFTNL_OUTPUT_DEFAULT:
return snprintf(buf, len, "name %s rev %u ",
->snprintf() is always called via nftnl_expr_snprintf() wrapper, which is already dealing with this corner case for us. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> --- src/expr/bitwise.c | 3 --- src/expr/byteorder.c | 3 --- src/expr/cmp.c | 3 --- src/expr/counter.c | 3 --- src/expr/ct.c | 3 --- src/expr/dup.c | 3 --- src/expr/dynset.c | 3 --- src/expr/exthdr.c | 3 --- src/expr/fib.c | 3 --- src/expr/fwd.c | 3 --- src/expr/hash.c | 3 --- src/expr/immediate.c | 3 --- src/expr/limit.c | 3 --- src/expr/log.c | 3 --- src/expr/lookup.c | 3 --- src/expr/masq.c | 3 --- src/expr/match.c | 3 --- src/expr/meta.c | 3 --- src/expr/nat.c | 3 --- src/expr/numgen.c | 3 --- src/expr/objref.c | 3 --- src/expr/payload.c | 3 --- src/expr/queue.c | 3 --- src/expr/quota.c | 3 --- src/expr/range.c | 3 --- src/expr/redir.c | 3 --- src/expr/reject.c | 3 --- src/expr/rt.c | 3 --- src/expr/target.c | 3 --- 29 files changed, 87 deletions(-)