diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2021-02-21 18:26:22 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2021-02-24 15:12:06 +0900 |
commit | a4cff327d8533bde5bac147aaa8b09e8d835cab2 (patch) | |
tree | 9889be35939b00f0b9063ae5c88148323911a9b1 /scripts/kconfig | |
parent | f82bd80d37ecc6ebda389473bd8414e89bbdbe05 (diff) | |
download | linux-stable-a4cff327d8533bde5bac147aaa8b09e8d835cab2.tar.gz linux-stable-a4cff327d8533bde5bac147aaa8b09e8d835cab2.tar.bz2 linux-stable-a4cff327d8533bde5bac147aaa8b09e8d835cab2.zip |
kconfig: clean up nested if-conditionals in check_conf()
Unify the outer two if-conditionals into one. This decreases the
indent level by one.
Also, change the if-else blocks:
if (input_mode == listnewconfig) {
...
} else if (input_mode == helpnewconfig) {
...
} else {
...
}
into the switch statement.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r-- | scripts/kconfig/conf.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 18a233d27a8d..369615d6c97e 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -419,34 +419,37 @@ static void check_conf(struct menu *menu) return; sym = menu->sym; - if (sym && !sym_has_value(sym)) { - if (sym_is_changeable(sym) || - (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { - if (input_mode == listnewconfig) { - if (sym->name) { - const char *str; - - if (sym->type == S_STRING) { - str = sym_get_string_value(sym); - str = sym_escape_string_value(str); - printf("%s%s=%s\n", CONFIG_, sym->name, str); - free((void *)str); - } else { - str = sym_get_string_value(sym); - printf("%s%s=%s\n", CONFIG_, sym->name, str); - } - } - } else if (input_mode == helpnewconfig) { - printf("-----\n"); - print_help(menu); - printf("-----\n"); + if (sym && !sym_has_value(sym) && + (sym_is_changeable(sym) || + (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes))) { - } else { - if (!conf_cnt++) - printf("*\n* Restart config...\n*\n"); - rootEntry = menu_get_parent_menu(menu); - conf(rootEntry); + switch (input_mode) { + case listnewconfig: + if (sym->name) { + const char *str; + + if (sym->type == S_STRING) { + str = sym_get_string_value(sym); + str = sym_escape_string_value(str); + printf("%s%s=%s\n", CONFIG_, sym->name, str); + free((void *)str); + } else { + str = sym_get_string_value(sym); + printf("%s%s=%s\n", CONFIG_, sym->name, str); + } } + break; + case helpnewconfig: + printf("-----\n"); + print_help(menu); + printf("-----\n"); + break; + default: + if (!conf_cnt++) + printf("*\n* Restart config...\n*\n"); + rootEntry = menu_get_parent_menu(menu); + conf(rootEntry); + break; } } |