kconfig: use menu_for_each_entry() to traverse menu tree
Use menu_for_each_entry() to traverse the menu tree instead of implementing similar logic in each function. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
7284b4fbc8
commit
03c4ecaa5c
@ -793,23 +793,19 @@ int conf_write_defconfig(const char *filename)
|
|||||||
|
|
||||||
sym_clear_all_valid();
|
sym_clear_all_valid();
|
||||||
|
|
||||||
/* Traverse all menus to find all relevant symbols */
|
menu_for_each_entry(menu) {
|
||||||
menu = rootmenu.list;
|
|
||||||
|
|
||||||
while (menu != NULL)
|
|
||||||
{
|
|
||||||
sym = menu->sym;
|
sym = menu->sym;
|
||||||
if (sym && !sym_is_choice(sym)) {
|
if (sym && !sym_is_choice(sym)) {
|
||||||
sym_calc_value(sym);
|
sym_calc_value(sym);
|
||||||
if (!(sym->flags & SYMBOL_WRITE))
|
if (!(sym->flags & SYMBOL_WRITE))
|
||||||
goto next_menu;
|
continue;
|
||||||
sym->flags &= ~SYMBOL_WRITE;
|
sym->flags &= ~SYMBOL_WRITE;
|
||||||
/* If we cannot change the symbol - skip */
|
/* If we cannot change the symbol - skip */
|
||||||
if (!sym_is_changeable(sym))
|
if (!sym_is_changeable(sym))
|
||||||
goto next_menu;
|
continue;
|
||||||
/* If symbol equals to default value - skip */
|
/* If symbol equals to default value - skip */
|
||||||
if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0)
|
if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0)
|
||||||
goto next_menu;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If symbol is a choice value and equals to the
|
* If symbol is a choice value and equals to the
|
||||||
@ -827,25 +823,11 @@ int conf_write_defconfig(const char *filename)
|
|||||||
if (!sym_is_optional(cs) && sym == ds) {
|
if (!sym_is_optional(cs) && sym == ds) {
|
||||||
if ((sym->type == S_BOOLEAN) &&
|
if ((sym->type == S_BOOLEAN) &&
|
||||||
sym_get_tristate_value(sym) == yes)
|
sym_get_tristate_value(sym) == yes)
|
||||||
goto next_menu;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print_symbol_for_dotconfig(out, sym);
|
print_symbol_for_dotconfig(out, sym);
|
||||||
}
|
}
|
||||||
next_menu:
|
|
||||||
if (menu->list != NULL) {
|
|
||||||
menu = menu->list;
|
|
||||||
}
|
|
||||||
else if (menu->next != NULL) {
|
|
||||||
menu = menu->next;
|
|
||||||
} else {
|
|
||||||
while ((menu = menu->parent)) {
|
|
||||||
if (menu->next != NULL) {
|
|
||||||
menu = menu->next;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fclose(out);
|
fclose(out);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -517,20 +517,9 @@ void conf_parse(const char *name)
|
|||||||
|
|
||||||
menu_finalize();
|
menu_finalize();
|
||||||
|
|
||||||
menu = &rootmenu;
|
menu_for_each_entry(menu) {
|
||||||
while (menu) {
|
|
||||||
if (menu->sym && sym_check_deps(menu->sym))
|
if (menu->sym && sym_check_deps(menu->sym))
|
||||||
yynerrs++;
|
yynerrs++;
|
||||||
|
|
||||||
if (menu->list) {
|
|
||||||
menu = menu->list;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!menu->next && menu->parent)
|
|
||||||
menu = menu->parent;
|
|
||||||
|
|
||||||
menu = menu->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yynerrs)
|
if (yynerrs)
|
||||||
|
Loading…
Reference in New Issue
Block a user