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.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -419,34 +419,37 @@ static void check_conf(struct menu *menu) · 418 unmodified lines | ||
| 419 | 419 | return; |
| 420 | 420 | |
| 421 | 421 | sym = menu->sym; |
| 422 | − if (sym && !sym_has_value(sym)) { | |
| 423 | − if (sym_is_changeable(sym) || | |
| 424 | − (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { | |
| 425 | − if (input_mode == listnewconfig) { | |
| 426 | − if (sym->name) { | |
| 427 | − const char *str; | |
| 428 | − | |
| 429 | − if (sym->type == S_STRING) { | |
| 430 | − str = sym_get_string_value(sym); | |
| 431 | − str = sym_escape_string_value(str); | |
| 432 | − printf("%s%s=%s\n", CONFIG_, sym->name, str); | |
| 433 | − free((void *)str); | |
| 434 | − } else { | |
| 435 | − str = sym_get_string_value(sym); | |
| 436 | − printf("%s%s=%s\n", CONFIG_, sym->name, str); | |
| 437 | − } | |
| 438 | − } | |
| 439 | − } else if (input_mode == helpnewconfig) { | |
| 440 | − printf("-----\n"); | |
| 441 | − print_help(menu); | |
| 442 | − printf("-----\n"); | |
| 422 | + if (sym && !sym_has_value(sym) && | |
| 423 | + (sym_is_changeable(sym) || | |
| 424 | + (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes))) { | |
| 443 | 425 | |
| 444 | − } else { | |
| 445 | − if (!conf_cnt++) | |
| 446 | − printf("*\n* Restart config...\n*\n"); | |
| 447 | − rootEntry = menu_get_parent_menu(menu); | |
| 448 | − conf(rootEntry); | |
| 426 | + switch (input_mode) { | |
| 427 | + case listnewconfig: | |
| 428 | + if (sym->name) { | |
| 429 | + const char *str; | |
| 430 | + | |
| 431 | + if (sym->type == S_STRING) { | |
| 432 | + str = sym_get_string_value(sym); | |
| 433 | + str = sym_escape_string_value(str); | |
| 434 | + printf("%s%s=%s\n", CONFIG_, sym->name, str); | |
| 435 | + free((void *)str); | |
| 436 | + } else { | |
| 437 | + str = sym_get_string_value(sym); | |
| 438 | + printf("%s%s=%s\n", CONFIG_, sym->name, str); | |
| 439 | + } | |
| 449 | 440 | } |
| 441 | + break; | |
| 442 | + case helpnewconfig: | |
| 443 | + printf("-----\n"); | |
| 444 | + print_help(menu); | |
| 445 | + printf("-----\n"); | |
| 446 | + break; | |
| 447 | + default: | |
| 448 | + if (!conf_cnt++) | |
| 449 | + printf("*\n* Restart config...\n*\n"); | |
| 450 | + rootEntry = menu_get_parent_menu(menu); | |
| 451 | + conf(rootEntry); | |
| 452 | + break; | |
| 450 | 453 | } |
| 451 | 454 | } |
| 452 | 455 | |