Skip to content

Commit

Permalink
kconfig: refactor conf_write_defconfig() to reduce indentation level
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Masahiro Yamada committed Jul 15, 2024
1 parent 826ee96 commit 995150e
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions scripts/kconfig/confdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 995150e

Please sign in to comment.