@@ -867,9 +867,6 @@ EXPORT_SYMBOL(nftnl_chain_snprintf);
static int nftnl_chain_do_snprintf(char *buf, size_t size, const void *c,
uint32_t cmd, uint32_t type, uint32_t flags)
{
- if (size)
- buf[0] = '\0';
-
return nftnl_chain_snprintf(buf, size, c, type, flags);
}
@@ -94,9 +94,6 @@ EXPORT_SYMBOL(nftnl_parse_perror);
int nftnl_cmd_header_snprintf(char *buf, size_t size, uint32_t cmd, uint32_t type,
uint32_t flags)
{
- if (size)
- buf[0] = '\0';
-
NFTNL_BUF_INIT(b, buf, size);
if (cmd == NFTNL_CMD_UNSPEC)
@@ -138,9 +135,6 @@ int nftnl_cmd_header_fprintf(FILE *fp, uint32_t cmd, uint32_t type,
int nftnl_cmd_footer_snprintf(char *buf, size_t size, uint32_t cmd, uint32_t type,
uint32_t flags)
{
- if (size)
- buf[0] = '\0';
-
NFTNL_BUF_INIT(b, buf, size);
if (cmd == NFTNL_CMD_UNSPEC)
@@ -203,9 +203,6 @@ EXPORT_SYMBOL(nftnl_gen_snprintf);
static int nftnl_gen_do_snprintf(char *buf, size_t size, const void *gen,
uint32_t cmd, uint32_t type, uint32_t flags)
{
- if (size)
- buf = '\0';
-
return nftnl_gen_snprintf(buf, size, gen, type, flags);
}
@@ -488,9 +488,6 @@ EXPORT_SYMBOL(nftnl_obj_snprintf);
static int nftnl_obj_do_snprintf(char *buf, size_t size, const void *obj,
uint32_t cmd, uint32_t type, uint32_t flags)
{
- if (size)
- buf[0] = '\0';
-
return nftnl_obj_snprintf(buf, size, obj, type, flags);
}
@@ -836,9 +836,6 @@ EXPORT_SYMBOL(nftnl_rule_snprintf);
static int nftnl_rule_do_snprintf(char *buf, size_t size, const void *r,
uint32_t cmd, uint32_t type, uint32_t flags)
{
- if (size)
- buf[0] = '\0';
-
return nftnl_rule_snprintf(buf, size, r, type, flags);
}
@@ -939,9 +939,6 @@ EXPORT_SYMBOL(nftnl_set_snprintf);
static int nftnl_set_do_snprintf(char *buf, size_t size, const void *s,
uint32_t cmd, uint32_t type, uint32_t flags)
{
- if (size)
- buf[0] = '\0';
-
return nftnl_set_snprintf(buf, size, s, type, flags);
}
@@ -738,9 +738,6 @@ static int nftnl_set_elem_do_snprintf(char *buf, size_t size, const void *e,
uint32_t cmd, uint32_t type,
uint32_t flags)
{
- if (size)
- buf[0] = '\0';
-
return nftnl_set_elem_snprintf(buf, size, e, type, flags);
}
@@ -417,9 +417,6 @@ EXPORT_SYMBOL(nftnl_table_snprintf);
static int nftnl_table_do_snprintf(char *buf, size_t size, const void *t,
uint32_t cmd, uint32_t type, uint32_t flags)
{
- if (size)
- buf[0] = '\0';
-
return nftnl_table_snprintf(buf, size, t, type, flags);
}
This function bails out with -1 if we cannot print, and this buffer is internally allocated. No need for this overly deffensive initialization. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> --- src/chain.c | 3 --- src/common.c | 6 ------ src/gen.c | 3 --- src/object.c | 3 --- src/rule.c | 3 --- src/set.c | 3 --- src/set_elem.c | 3 --- src/table.c | 3 --- 8 files changed, 27 deletions(-)