summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-02-28 16:06:16 +0100
committerFlorian Westphal <fw@strlen.de>2018-02-28 16:59:19 +0100
commit7f31d3191622b650521014e311ace96aa7c5522c (patch)
treee27bde4056fd7b21f3d09aaf689aa2573238afc9 /src
parent48b99f03b5e43eac2bf93251f8fa1c9ceb516abb (diff)
Review switch statements for unmarked fall through cases
While revisiting all of them, clear a few oddities as well: - There's no point in marking empty fall through cases: They are easy to spot and a common concept when using switch(). - Fix indenting of break statement in one occasion. - Drop needless braces around one case which doesn't declare variables. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src')
-rw-r--r--src/ct.c2
-rw-r--r--src/evaluate.c1
-rw-r--r--src/hash.c2
-rw-r--r--src/netlink_delinearize.c1
-rw-r--r--src/rule.c5
5 files changed, 7 insertions, 4 deletions
diff --git a/src/ct.c b/src/ct.c
index d5347974..bdf50d7a 100644
--- a/src/ct.c
+++ b/src/ct.c
@@ -289,7 +289,7 @@ static void ct_print(enum nft_ct_keys key, int8_t dir, uint8_t nfproto,
}
switch (key) {
- case NFT_CT_SRC: /* fallthrough */
+ case NFT_CT_SRC:
case NFT_CT_DST:
desc = proto_find_upper(&proto_inet, nfproto);
if (desc)
diff --git a/src/evaluate.c b/src/evaluate.c
index 6be3bf03..54fd6b61 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -2712,6 +2712,7 @@ static int stmt_evaluate_objref_map(struct eval_ctx *ctx, struct stmt *stmt)
map->mappings->set->flags |=
map->mappings->set->init->set_flags;
+ /* fall through */
case EXPR_SYMBOL:
if (expr_evaluate(ctx, &map->mappings) < 0)
return -1;
diff --git a/src/hash.c b/src/hash.c
index 9cd3c8cf..3355cadd 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -20,7 +20,7 @@ static void hash_expr_print(const struct expr *expr, struct output_ctx *octx)
switch (expr->hash.type) {
case NFT_HASH_SYM:
nft_print(octx, "symhash");
- break;
+ break;
case NFT_HASH_JENKINS:
default:
nft_print(octx, "jhash ");
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index a1f0e923..9dbd9141 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -1485,6 +1485,7 @@ static void ct_meta_common_postprocess(struct rule_pp_ctx *ctx,
case OP_NEQ:
if (right->ops->type != EXPR_SET && right->ops->type != EXPR_SET_REF)
break;
+ /* fall through */
case OP_LOOKUP:
expr_set_type(right, left->dtype, left->byteorder);
break;
diff --git a/src/rule.c b/src/rule.c
index 5b7219e8..a53908f6 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -1341,7 +1341,7 @@ static void obj_print_data(const struct obj *obj,
}
}
break;
- case NFT_OBJECT_CT_HELPER: {
+ case NFT_OBJECT_CT_HELPER:
nft_print(octx, "ct helper %s {\n", obj->handle.obj);
nft_print(octx, "\t\ttype \"%s\" protocol ",
obj->ct_helper.name);
@@ -1349,7 +1349,6 @@ static void obj_print_data(const struct obj *obj,
nft_print(octx, "\t\tl3proto %s",
family2str(obj->ct_helper.l3proto));
break;
- }
case NFT_OBJECT_LIMIT: {
bool inv = obj->limit.flags & NFT_LIMIT_F_INV;
const char *data_unit;
@@ -1661,11 +1660,13 @@ static int do_command_reset(struct netlink_ctx *ctx, struct cmd *cmd)
switch (cmd->obj) {
case CMD_OBJ_COUNTERS:
dump = true;
+ /* fall through */
case CMD_OBJ_COUNTER:
type = NFT_OBJECT_COUNTER;
break;
case CMD_OBJ_QUOTAS:
dump = true;
+ /* fall through */
case CMD_OBJ_QUOTA:
type = NFT_OBJECT_QUOTA;
break;