Blame SOURCES/0004-Review-switch-statements-for-unmarked-fall-through-c.patch

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