diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-07-21 15:26:02 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-07-21 15:33:56 +0200 |
commit | cc9573dfa25585a415f6c12950758ce32f337294 (patch) | |
tree | 95471849b13a864f01be62e5961f087ab199022e /src/table.c | |
parent | d4faa02971e3924512f93e1d369bb134aa6d96b1 (diff) |
src: remove default case from nft_*_attr_unset
This patch removes the default case in nft_*_attr_unset, thus, the
compiler will spot a warning if we add a new attribute in the future
and you forget to handle it.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/table.c')
-rw-r--r-- | src/table.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/table.c b/src/table.c index b2ebaa3..e9e6d59 100644 --- a/src/table.c +++ b/src/table.c @@ -57,20 +57,19 @@ EXPORT_SYMBOL(nft_table_attr_is_set); void nft_table_attr_unset(struct nft_table *t, uint16_t attr) { + if (!(t->flags & (1 << attr))) + return; + switch (attr) { case NFT_TABLE_ATTR_NAME: - if (t->flags & (1 << NFT_TABLE_ATTR_NAME)) { - if (t->name) { - free(t->name); - t->name = NULL; - } + if (t->name) { + free(t->name); + t->name = NULL; } break; case NFT_TABLE_ATTR_FLAGS: case NFT_TABLE_ATTR_FAMILY: break; - default: - return; } t->flags &= ~(1 << attr); } |