diff mbox series

[1/6] util.c: code cleanup for parse_layout_faulty()

Message ID 20230303083323.3406-2-colyli@suse.de (mailing list archive)
State Superseded, archived
Headers show
Series rebased patch set from Wu Guanghao | expand

Commit Message

Coly Li March 3, 2023, 8:33 a.m. UTC
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(-)

Comments

Paul Menzel March 3, 2023, 10:22 a.m. UTC | #1
Dear Coly,


Am 03.03.23 um 09:33 schrieb Coly Li:
> Resort the code lines in parse_layout_faulty() to make it more
> comfortable, no logic change.

Maybe use a more specific subject line and make it a statement by using 
a verb (imperative mood):

util.c: Reorder code lines in `parse_layout_faulty()`

> 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)

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul
diff mbox series

Patch

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)