Blame SOURCES/0009-checkpolicy-follow-declaration-after-statement.patch

83845a
From 79e7724930d49cc8cdac4c7d4e80b1fafd22d1d7 Mon Sep 17 00:00:00 2001
83845a
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
83845a
Date: Tue, 6 Jul 2021 19:54:26 +0200
83845a
Subject: [PATCH] checkpolicy: follow declaration-after-statement
83845a
MIME-Version: 1.0
83845a
Content-Type: text/plain; charset=UTF-8
83845a
Content-Transfer-Encoding: 8bit
83845a
83845a
Follow the project style of no declaration after statement.
83845a
83845a
Found by the GCC warning -Wdeclaration-after-statement.
83845a
83845a
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
83845a
---
83845a
 checkpolicy/checkmodule.c   | 6 ++++--
83845a
 checkpolicy/policy_define.c | 3 ++-
83845a
 checkpolicy/test/dismod.c   | 2 +-
83845a
 3 files changed, 7 insertions(+), 4 deletions(-)
83845a
83845a
diff --git a/checkpolicy/checkmodule.c b/checkpolicy/checkmodule.c
83845a
index 40d0ec9924e9..316b289865e1 100644
83845a
--- a/checkpolicy/checkmodule.c
83845a
+++ b/checkpolicy/checkmodule.c
83845a
@@ -288,14 +288,16 @@ int main(int argc, char **argv)
83845a
 	}
83845a
 
83845a
 	if (policy_type != POLICY_BASE && outfile) {
83845a
+		char *out_name;
83845a
+		char *separator;
83845a
 		char *mod_name = modpolicydb.name;
83845a
 		char *out_path = strdup(outfile);
83845a
 		if (out_path == NULL) {
83845a
 			fprintf(stderr, "%s:  out of memory\n", argv[0]);
83845a
 			exit(1);
83845a
 		}
83845a
-		char *out_name = basename(out_path);
83845a
-		char *separator = strrchr(out_name, '.');
83845a
+		out_name = basename(out_path);
83845a
+		separator = strrchr(out_name, '.');
83845a
 		if (separator) {
83845a
 			*separator = '\0';
83845a
 		}
83845a
diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
83845a
index 7eff747adacf..049df55f8468 100644
83845a
--- a/checkpolicy/policy_define.c
83845a
+++ b/checkpolicy/policy_define.c
83845a
@@ -1904,9 +1904,10 @@ int avrule_read_ioctls(struct av_ioctl_range_list **rangehead)
83845a
 {
83845a
 	char *id;
83845a
 	struct av_ioctl_range_list *rnew, *r = NULL;
83845a
-	*rangehead = NULL;
83845a
 	uint8_t omit = 0;
83845a
 
83845a
+	*rangehead = NULL;
83845a
+
83845a
 	/* read in all the ioctl commands */
83845a
 	while ((id = queue_remove(id_queue))) {
83845a
 		if (strcmp(id,"~") == 0) {
83845a
diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c
83845a
index fadbc8d16695..b1b96115e79e 100644
83845a
--- a/checkpolicy/test/dismod.c
83845a
+++ b/checkpolicy/test/dismod.c
83845a
@@ -697,8 +697,8 @@ int display_avblock(int field, policydb_t * policy,
83845a
 {
83845a
 	avrule_block_t *block = policydb.global;
83845a
 	while (block != NULL) {
83845a
-		fprintf(out_fp, "--- begin avrule block ---\n");
83845a
 		avrule_decl_t *decl = block->branch_list;
83845a
+		fprintf(out_fp, "--- begin avrule block ---\n");
83845a
 		while (decl != NULL) {
83845a
 			if (display_avdecl(decl, field, policy, out_fp)) {
83845a
 				return -1;
83845a
-- 
83845a
2.32.0
83845a