lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 5 Jun 2024 22:30:14 +0200
From: Nicolas Schier <nicolas@...sle.eu>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] kconfig: refactor conf_write_defconfig() to reduce
 indentation level

On Sun, Jun 02, 2024 at 09:54:16PM +0900 Masahiro Yamada wrote:
> Reduce the indentation level by continue'ing the loop earlier
> if (!sym || sym_is_choice(sym)).
> 
> No functional change intended.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> ---
> 
>  scripts/kconfig/confdata.c | 47 ++++++++++++++++++--------------------
>  1 file changed, 22 insertions(+), 25 deletions(-)
> 
> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
> index 25c327ae3c5c..1ac7fc9ad756 100644
> --- a/scripts/kconfig/confdata.c
> +++ b/scripts/kconfig/confdata.c
> @@ -774,34 +774,31 @@ int conf_write_defconfig(const char *filename)
>  		struct menu *choice;
>  
>  		sym = menu->sym;
> -		if (sym && !sym_is_choice(sym)) {
> -			sym_calc_value(sym);
> -			if (!(sym->flags & SYMBOL_WRITE))
> -				continue;
> -			sym->flags &= ~SYMBOL_WRITE;
> -			/* If we cannot change the symbol - skip */
> -			if (!sym_is_changeable(sym))
> -				continue;
> -			/* If symbol equals to default value - skip */
> -			if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0)
> -				continue;
>  
> -			/*
> -			 * If symbol is a choice value and equals to the
> -			 * default for a choice - skip.
> -			 */
> -			choice = sym_get_choice_menu(sym);
> -			if (choice) {
> -				struct symbol *ds;
> +		if (!sym || sym_is_choice(sym))
> +			continue;
>  
> -				ds = sym_choice_default(choice->sym);
> -				if (sym == ds) {
> -					if (sym_get_tristate_value(sym) == yes)
> -						continue;
> -				}
> -			}
> -			print_symbol_for_dotconfig(out, sym);
> +		sym_calc_value(sym);
> +		if (!(sym->flags & SYMBOL_WRITE))
> +			continue;
> +		sym->flags &= ~SYMBOL_WRITE;
> +		/* Skip unchangeable symbols */
> +		if (!sym_is_changeable(sym))
> +			continue;
> +		/* Skip symbols that are equal to the default */
> +		if (!strcmp(sym_get_string_value(sym), sym_get_string_default(sym)))
> +			continue;
> +
> +		/* Skip choice values that are equal to the default */
> +		choice = sym_get_choice_menu(sym);
> +		if (choice) {
> +			struct symbol *ds;
> +
> +			ds = sym_choice_default(choice->sym);
> +			if (sym == ds && sym_get_tristate_value(sym) == yes)
> +				continue;
>  		}
> +		print_symbol_for_dotconfig(out, sym);
>  	}
>  	fclose(out);
>  	return 0;
> -- 
> 2.40.1
> 
> 

Reviewed-by: Nicolas Schier <nicolas@...sle.eu>

-- 
epost|xmpp: nicolas@...sle.eu          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ