|
|
a05102 |
From 8a8b80fafcbf3843e1736daff707b7cb5b64f31f Mon Sep 17 00:00:00 2001
|
|
|
a05102 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
a05102 |
Date: Wed, 20 Jun 2018 09:22:00 +0200
|
|
|
a05102 |
Subject: [PATCH] Review switch statements for unmarked fall through cases
|
|
|
a05102 |
|
|
|
a05102 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1504157
|
|
|
a05102 |
Upstream Status: nftables commit 7f31d3191622b
|
|
|
a05102 |
|
|
|
a05102 |
commit 7f31d3191622b650521014e311ace96aa7c5522c
|
|
|
a05102 |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
a05102 |
Date: Wed Feb 28 16:06:16 2018 +0100
|
|
|
a05102 |
|
|
|
a05102 |
Review switch statements for unmarked fall through cases
|
|
|
a05102 |
|
|
|
a05102 |
While revisiting all of them, clear a few oddities as well:
|
|
|
a05102 |
|
|
|
a05102 |
- There's no point in marking empty fall through cases: They are easy to
|
|
|
a05102 |
spot and a common concept when using switch().
|
|
|
a05102 |
|
|
|
a05102 |
- Fix indenting of break statement in one occasion.
|
|
|
a05102 |
|
|
|
a05102 |
- Drop needless braces around one case which doesn't declare variables.
|
|
|
a05102 |
|
|
|
a05102 |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
a05102 |
Signed-off-by: Florian Westphal <fw@strlen.de>
|
|
|
a05102 |
---
|
|
|
a05102 |
src/ct.c | 2 +-
|
|
|
a05102 |
src/evaluate.c | 1 +
|
|
|
a05102 |
src/hash.c | 2 +-
|
|
|
a05102 |
src/netlink_delinearize.c | 1 +
|
|
|
a05102 |
src/rule.c | 5 +++--
|
|
|
a05102 |
5 files changed, 7 insertions(+), 4 deletions(-)
|
|
|
a05102 |
|
|
|
a05102 |
diff --git a/src/ct.c b/src/ct.c
|
|
|
a05102 |
index 8ab32e9..1e06013 100644
|
|
|
a05102 |
--- a/src/ct.c
|
|
|
a05102 |
+++ b/src/ct.c
|
|
|
a05102 |
@@ -289,7 +289,7 @@ static void ct_print(enum nft_ct_keys key, int8_t dir, uint8_t nfproto,
|
|
|
a05102 |
}
|
|
|
a05102 |
|
|
|
a05102 |
switch (key) {
|
|
|
a05102 |
- case NFT_CT_SRC: /* fallthrough */
|
|
|
a05102 |
+ case NFT_CT_SRC:
|
|
|
a05102 |
case NFT_CT_DST:
|
|
|
a05102 |
desc = proto_find_upper(&proto_inet, nfproto);
|
|
|
a05102 |
if (desc)
|
|
|
a05102 |
diff --git a/src/evaluate.c b/src/evaluate.c
|
|
|
a05102 |
index f16bb33..25a7376 100644
|
|
|
a05102 |
--- a/src/evaluate.c
|
|
|
a05102 |
+++ b/src/evaluate.c
|
|
|
a05102 |
@@ -2705,6 +2705,7 @@ static int stmt_evaluate_objref_map(struct eval_ctx *ctx, struct stmt *stmt)
|
|
|
a05102 |
|
|
|
a05102 |
map->mappings->set->flags |=
|
|
|
a05102 |
map->mappings->set->init->set_flags;
|
|
|
a05102 |
+ /* fall through */
|
|
|
a05102 |
case EXPR_SYMBOL:
|
|
|
a05102 |
if (expr_evaluate(ctx, &map->mappings) < 0)
|
|
|
a05102 |
return -1;
|
|
|
a05102 |
diff --git a/src/hash.c b/src/hash.c
|
|
|
a05102 |
index 9cd3c8c..3355cad 100644
|
|
|
a05102 |
--- a/src/hash.c
|
|
|
a05102 |
+++ b/src/hash.c
|
|
|
a05102 |
@@ -20,7 +20,7 @@ static void hash_expr_print(const struct expr *expr, struct output_ctx *octx)
|
|
|
a05102 |
switch (expr->hash.type) {
|
|
|
a05102 |
case NFT_HASH_SYM:
|
|
|
a05102 |
nft_print(octx, "symhash");
|
|
|
a05102 |
- break;
|
|
|
a05102 |
+ break;
|
|
|
a05102 |
case NFT_HASH_JENKINS:
|
|
|
a05102 |
default:
|
|
|
a05102 |
nft_print(octx, "jhash ");
|
|
|
a05102 |
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
|
|
|
a05102 |
index 11fd330..61cba52 100644
|
|
|
a05102 |
--- a/src/netlink_delinearize.c
|
|
|
a05102 |
+++ b/src/netlink_delinearize.c
|
|
|
a05102 |
@@ -1411,6 +1411,7 @@ static void ct_meta_common_postprocess(struct rule_pp_ctx *ctx,
|
|
|
a05102 |
case OP_NEQ:
|
|
|
a05102 |
if (right->ops->type != EXPR_SET && right->ops->type != EXPR_SET_REF)
|
|
|
a05102 |
break;
|
|
|
a05102 |
+ /* fall through */
|
|
|
a05102 |
case OP_LOOKUP:
|
|
|
a05102 |
expr_set_type(right, left->dtype, left->byteorder);
|
|
|
a05102 |
break;
|
|
|
a05102 |
diff --git a/src/rule.c b/src/rule.c
|
|
|
a05102 |
index d744cf6..e7ccb2b 100644
|
|
|
a05102 |
--- a/src/rule.c
|
|
|
a05102 |
+++ b/src/rule.c
|
|
|
a05102 |
@@ -1297,7 +1297,7 @@ static void obj_print_data(const struct obj *obj,
|
|
|
a05102 |
}
|
|
|
a05102 |
}
|
|
|
a05102 |
break;
|
|
|
a05102 |
- case NFT_OBJECT_CT_HELPER: {
|
|
|
a05102 |
+ case NFT_OBJECT_CT_HELPER:
|
|
|
a05102 |
nft_print(octx, "ct helper %s {\n", obj->handle.obj);
|
|
|
a05102 |
nft_print(octx, "\t\ttype \"%s\" protocol ",
|
|
|
a05102 |
obj->ct_helper.name);
|
|
|
a05102 |
@@ -1305,7 +1305,6 @@ static void obj_print_data(const struct obj *obj,
|
|
|
a05102 |
nft_print(octx, "\t\tl3proto %s",
|
|
|
a05102 |
family2str(obj->ct_helper.l3proto));
|
|
|
a05102 |
break;
|
|
|
a05102 |
- }
|
|
|
a05102 |
case NFT_OBJECT_LIMIT: {
|
|
|
a05102 |
bool inv = obj->limit.flags & NFT_LIMIT_F_INV;
|
|
|
a05102 |
const char *data_unit;
|
|
|
a05102 |
@@ -1617,11 +1616,13 @@ static int do_command_reset(struct netlink_ctx *ctx, struct cmd *cmd)
|
|
|
a05102 |
switch (cmd->obj) {
|
|
|
a05102 |
case CMD_OBJ_COUNTERS:
|
|
|
a05102 |
dump = true;
|
|
|
a05102 |
+ /* fall through */
|
|
|
a05102 |
case CMD_OBJ_COUNTER:
|
|
|
a05102 |
type = NFT_OBJECT_COUNTER;
|
|
|
a05102 |
break;
|
|
|
a05102 |
case CMD_OBJ_QUOTAS:
|
|
|
a05102 |
dump = true;
|
|
|
a05102 |
+ /* fall through */
|
|
|
a05102 |
case CMD_OBJ_QUOTA:
|
|
|
a05102 |
type = NFT_OBJECT_QUOTA;
|
|
|
a05102 |
break;
|
|
|
a05102 |
--
|
|
|
a05102 |
1.8.3.1
|
|
|
a05102 |
|