diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-28 05:21:42 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-28 14:31:19 -0400 |
commit | 96d8e48da55ab294fb26ce695ab48a9e9829b4fa (patch) | |
tree | f464adc79e6ee795dd1ec0d0668daff4b731c00a /scripts/kconfig | |
parent | bb222ceeb327a9bd484ba763fe86644f6d97e0cc (diff) |
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 0724a7c32a54 ("kconfig: Don't leak
main menus during parsing") can go away.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r-- | scripts/kconfig/zconf.y | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 031b2e24ae00..22e318c1d3d1 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -109,7 +109,7 @@ static struct menu *current_menu, *current_entry; | |||
109 | %% | 109 | %% |
110 | input: nl start | start; | 110 | input: nl start | start; |
111 | 111 | ||
112 | start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list; | 112 | start: mainmenu_stmt stmt_list | stmt_list; |
113 | 113 | ||
114 | /* mainmenu entry */ | 114 | /* mainmenu entry */ |
115 | 115 | ||
@@ -118,19 +118,6 @@ mainmenu_stmt: T_MAINMENU prompt nl | |||
118 | menu_add_prompt(P_MENU, $2, NULL); | 118 | menu_add_prompt(P_MENU, $2, NULL); |
119 | }; | 119 | }; |
120 | 120 | ||
121 | /* Default main menu, if there's no mainmenu entry */ | ||
122 | |||
123 | no_mainmenu_stmt: /* empty */ | ||
124 | { | ||
125 | /* | ||
126 | * Hack: Keep the main menu title on the heap so we can safely free it | ||
127 | * later regardless of whether it comes from the 'prompt' in | ||
128 | * mainmenu_stmt or here | ||
129 | */ | ||
130 | menu_add_prompt(P_MENU, xstrdup("Linux Kernel Configuration"), NULL); | ||
131 | }; | ||
132 | |||
133 | |||
134 | stmt_list: | 121 | stmt_list: |
135 | /* empty */ | 122 | /* empty */ |
136 | | stmt_list common_stmt | 123 | | stmt_list common_stmt |
@@ -528,7 +515,6 @@ word_opt: /* empty */ { $$ = NULL; } | |||
528 | 515 | ||
529 | void conf_parse(const char *name) | 516 | void conf_parse(const char *name) |
530 | { | 517 | { |
531 | const char *tmp; | ||
532 | struct symbol *sym; | 518 | struct symbol *sym; |
533 | int i; | 519 | int i; |
534 | 520 | ||
@@ -544,10 +530,10 @@ void conf_parse(const char *name) | |||
544 | if (!modules_sym) | 530 | if (!modules_sym) |
545 | modules_sym = sym_find( "n" ); | 531 | modules_sym = sym_find( "n" ); |
546 | 532 | ||
547 | tmp = rootmenu.prompt->text; | 533 | if (!menu_has_prompt(&rootmenu)) { |
548 | rootmenu.prompt->text = rootmenu.prompt->text; | 534 | current_entry = &rootmenu; |
549 | rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); | 535 | menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); |
550 | free((char*)tmp); | 536 | } |
551 | 537 | ||
552 | menu_finalize(&rootmenu); | 538 | menu_finalize(&rootmenu); |
553 | for_all_symbols(i, sym) { | 539 | for_all_symbols(i, sym) { |