Skip to content

Commit 995150e

Browse files
committed
kconfig: refactor conf_write_defconfig() to reduce indentation level
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@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
1 parent 826ee96 commit 995150e

1 file changed

Lines changed: 22 additions & 25 deletions

File tree

scripts/kconfig/confdata.c

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -774,34 +774,31 @@ int conf_write_defconfig(const char *filename)
774774
struct menu *choice;
775775

776776
sym = menu->sym;
777-
if (sym && !sym_is_choice(sym)) {
778-
sym_calc_value(sym);
779-
if (!(sym->flags & SYMBOL_WRITE))
780-
continue;
781-
sym->flags &= ~SYMBOL_WRITE;
782-
/* If we cannot change the symbol - skip */
783-
if (!sym_is_changeable(sym))
784-
continue;
785-
/* If symbol equals to default value - skip */
786-
if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0)
787-
continue;
788777

789-
/*
790-
* If symbol is a choice value and equals to the
791-
* default for a choice - skip.
792-
*/
793-
choice = sym_get_choice_menu(sym);
794-
if (choice) {
795-
struct symbol *ds;
778+
if (!sym || sym_is_choice(sym))
779+
continue;
796780

797-
ds = sym_choice_default(choice->sym);
798-
if (sym == ds) {
799-
if (sym_get_tristate_value(sym) == yes)
800-
continue;
801-
}
802-
}
803-
print_symbol_for_dotconfig(out, sym);
781+
sym_calc_value(sym);
782+
if (!(sym->flags & SYMBOL_WRITE))
783+
continue;
784+
sym->flags &= ~SYMBOL_WRITE;
785+
/* Skip unchangeable symbols */
786+
if (!sym_is_changeable(sym))
787+
continue;
788+
/* Skip symbols that are equal to the default */
789+
if (!strcmp(sym_get_string_value(sym), sym_get_string_default(sym)))
790+
continue;
791+
792+
/* Skip choice values that are equal to the default */
793+
choice = sym_get_choice_menu(sym);
794+
if (choice) {
795+
struct symbol *ds;
796+
797+
ds = sym_choice_default(choice->sym);
798+
if (sym == ds && sym_get_tristate_value(sym) == yes)
799+
continue;
804800
}
801+
print_symbol_for_dotconfig(out, sym);
805802
}
806803
fclose(out);
807804
return 0;

0 commit comments

Comments
 (0)