linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: jes@trained-monkey.org
Cc: linux-raid@vger.kernel.org, Coly Li <colyli@suse.de>
Subject: [PATCH 1/6] util.c: code cleanup for parse_layout_faulty()
Date: Fri,  3 Mar 2023 16:33:18 +0800	[thread overview]
Message-ID: <20230303083323.3406-2-colyli@suse.de> (raw)
In-Reply-To: <20230303083323.3406-1-colyli@suse.de>

Resort the code lines in parse_layout_faulty() to make it more
comfortable, no logic change.

Signed-off-by: Coly Li <colyli@suse.de>
---
 util.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/util.c b/util.c
index 7fc881bf..b0b7aec4 100644
--- a/util.c
+++ b/util.c
@@ -421,12 +421,15 @@ int parse_layout_10(char *layout)
 
 int parse_layout_faulty(char *layout)
 {
+	int ln, mode;
+	char *m;
+
 	if (!layout)
 		return -1;
+
 	/* Parse the layout string for 'faulty' */
-	int ln = strcspn(layout, "0123456789");
-	char *m = xstrdup(layout);
-	int mode;
+	ln = strcspn(layout, "0123456789");
+	m = xstrdup(layout);
 	m[ln] = 0;
 	mode = map_name(faultylayout, m);
 	if (mode == UnSet)
-- 
2.39.2


  reply	other threads:[~2023-03-03  8:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03  8:33 [PATCH 0/6] rebased patch set from Wu Guanghao Coly Li
2023-03-03  8:33 ` Coly Li [this message]
2023-03-03 10:22   ` [PATCH 1/6] util.c: code cleanup for parse_layout_faulty() Paul Menzel
2023-03-03  8:33 ` [PATCH 2/6] util.c: fix memleak in parse_layout_faulty() Coly Li
2023-03-03  8:33 ` [PATCH 3/6] Detail.c: fix memleak in Detail() Coly Li
2023-03-03  8:33 ` [PATCH 4/6] isuper-intel.c: fix double free in load_imsm_mpb() Coly Li
2023-03-03  8:33 ` [PATCH 5/6] super-intel.c: fix memleak in find_disk_attached_hba() Coly Li
2023-03-03  8:33 ` [PATCH 6/6] super-ddf.c: fix memleak in get_vd_num_of_subarray() Coly Li

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=20230303083323.3406-2-colyli@suse.de \
    --to=colyli@suse.de \
    --cc=jes@trained-monkey.org \
    --cc=linux-raid@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).