selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christian Göttsche" <cgzones@googlemail.com>
To: selinux@vger.kernel.org
Subject: [PATCH 06/13] checkpolicy: follow declaration-after-statement
Date: Tue,  6 Jul 2021 19:54:26 +0200	[thread overview]
Message-ID: <20210706175433.29270-6-cgzones@googlemail.com> (raw)
In-Reply-To: <20210706175433.29270-1-cgzones@googlemail.com>

Follow the project style of no declaration after statement.

Found by the GCC warning -Wdeclaration-after-statement.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 checkpolicy/checkmodule.c   | 6 ++++--
 checkpolicy/policy_define.c | 3 ++-
 checkpolicy/test/dismod.c   | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/checkpolicy/checkmodule.c b/checkpolicy/checkmodule.c
index 40d0ec99..316b2898 100644
--- a/checkpolicy/checkmodule.c
+++ b/checkpolicy/checkmodule.c
@@ -288,14 +288,16 @@ int main(int argc, char **argv)
 	}
 
 	if (policy_type != POLICY_BASE && outfile) {
+		char *out_name;
+		char *separator;
 		char *mod_name = modpolicydb.name;
 		char *out_path = strdup(outfile);
 		if (out_path == NULL) {
 			fprintf(stderr, "%s:  out of memory\n", argv[0]);
 			exit(1);
 		}
-		char *out_name = basename(out_path);
-		char *separator = strrchr(out_name, '.');
+		out_name = basename(out_path);
+		separator = strrchr(out_name, '.');
 		if (separator) {
 			*separator = '\0';
 		}
diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
index 7eff747a..22218c07 100644
--- a/checkpolicy/policy_define.c
+++ b/checkpolicy/policy_define.c
@@ -1904,8 +1904,9 @@ int avrule_read_ioctls(struct av_ioctl_range_list **rangehead)
 {
 	char *id;
 	struct av_ioctl_range_list *rnew, *r = NULL;
-	*rangehead = NULL;
 	uint8_t omit = 0;
+	
+	*rangehead = NULL;	
 
 	/* read in all the ioctl commands */
 	while ((id = queue_remove(id_queue))) {
diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c
index fadbc8d1..b1b96115 100644
--- a/checkpolicy/test/dismod.c
+++ b/checkpolicy/test/dismod.c
@@ -697,8 +697,8 @@ int display_avblock(int field, policydb_t * policy,
 {
 	avrule_block_t *block = policydb.global;
 	while (block != NULL) {
-		fprintf(out_fp, "--- begin avrule block ---\n");
 		avrule_decl_t *decl = block->branch_list;
+		fprintf(out_fp, "--- begin avrule block ---\n");
 		while (decl != NULL) {
 			if (display_avdecl(decl, field, policy, out_fp)) {
 				return -1;
-- 
2.32.0


  parent reply	other threads:[~2021-07-06 17:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 17:54 [PATCH 01/13] checkpolicy: pass CFLAGS at link stage Christian Göttsche
2021-07-06 17:54 ` [PATCH 02/13] checkpolicy: drop -pipe compile option Christian Göttsche
2021-07-06 17:54 ` [PATCH 03/13] checkpolicy: simplify assignment Christian Göttsche
2021-07-06 17:54 ` [PATCH 04/13] checkpolicy: drop dead condition Christian Göttsche
2021-07-06 17:54 ` [PATCH 05/13] checkpolicy: use correct format specifier for unsigned Christian Göttsche
2021-07-06 17:54 ` Christian Göttsche [this message]
2021-07-12  7:13   ` [PATCH 06/13] checkpolicy: follow declaration-after-statement Nicolas Iooss
2021-07-13 19:59     ` Nicolas Iooss
2021-07-06 17:54 ` [PATCH 07/13] checkpolicy: remove dead assignments Christian Göttsche
2021-07-06 17:54 ` [PATCH 08/13] checkpolicy: check before potential NULL dereference Christian Göttsche
2021-07-06 17:54 ` [PATCH 09/13] checkpolicy: avoid potential use of uninitialized variable Christian Göttsche
2021-07-06 17:54 ` [PATCH 10/13] checkpolicy: drop redundant cast to the same type Christian Göttsche
2021-07-06 17:54 ` [PATCH 11/13] checkpolicy: parse_util drop unused declaration Christian Göttsche
2021-07-06 17:54 ` [PATCH 12/13] checkpolicy/test: mark file local functions static Christian Göttsche
2021-07-06 17:54 ` [PATCH 13/13] checkpolicy: mark read-only parameters in policy define const Christian Göttsche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210706175433.29270-6-cgzones@googlemail.com \
    --to=cgzones@googlemail.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).