Commit 96d8e48d authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: remove string expansion for mainmenu after yyparse()

Now that environments are expanded in the lexer, conf_parse() does
not need to expand them explicitly.

The hack introduced by commit 0724a7c3 ("kconfig: Don't leak
main menus during parsing") can go away.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarUlf Magnusson <ulfalizer@gmail.com>
parent bb222cee
...@@ -109,7 +109,7 @@ static struct menu *current_menu, *current_entry; ...@@ -109,7 +109,7 @@ static struct menu *current_menu, *current_entry;
%% %%
input: nl start | start; input: nl start | start;
start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list; start: mainmenu_stmt stmt_list | stmt_list;
/* mainmenu entry */ /* mainmenu entry */
...@@ -118,19 +118,6 @@ mainmenu_stmt: T_MAINMENU prompt nl ...@@ -118,19 +118,6 @@ mainmenu_stmt: T_MAINMENU prompt nl
menu_add_prompt(P_MENU, $2, NULL); menu_add_prompt(P_MENU, $2, NULL);
}; };
/* Default main menu, if there's no mainmenu entry */
no_mainmenu_stmt: /* empty */
{
/*
* Hack: Keep the main menu title on the heap so we can safely free it
* later regardless of whether it comes from the 'prompt' in
* mainmenu_stmt or here
*/
menu_add_prompt(P_MENU, xstrdup("Linux Kernel Configuration"), NULL);
};
stmt_list: stmt_list:
/* empty */ /* empty */
| stmt_list common_stmt | stmt_list common_stmt
...@@ -528,7 +515,6 @@ word_opt: /* empty */ { $$ = NULL; } ...@@ -528,7 +515,6 @@ word_opt: /* empty */ { $$ = NULL; }
void conf_parse(const char *name) void conf_parse(const char *name)
{ {
const char *tmp;
struct symbol *sym; struct symbol *sym;
int i; int i;
...@@ -544,10 +530,10 @@ void conf_parse(const char *name) ...@@ -544,10 +530,10 @@ void conf_parse(const char *name)
if (!modules_sym) if (!modules_sym)
modules_sym = sym_find( "n" ); modules_sym = sym_find( "n" );
tmp = rootmenu.prompt->text; if (!menu_has_prompt(&rootmenu)) {
rootmenu.prompt->text = rootmenu.prompt->text; current_entry = &rootmenu;
rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
free((char*)tmp); }
menu_finalize(&rootmenu); menu_finalize(&rootmenu);
for_all_symbols(i, sym) { for_all_symbols(i, sym) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment