Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2902263imm; Wed, 16 May 2018 23:19:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo5HqMLknAi9+7MMrPEJ4/stUxZHefvQL9U7dd4VS+ukj450l8j3/gJZputi3Vs+WhtKn3T X-Received: by 2002:a65:4a02:: with SMTP id s2-v6mr3095882pgq.265.1526537990418; Wed, 16 May 2018 23:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526537990; cv=none; d=google.com; s=arc-20160816; b=groEg7lN1szUhjuYYtjYjgvEsHG66wH4Dhr1Ysrk81b7vZobp0954CJIxOViiNsK+9 a5GsmEhFZ7NATfQAKrIJmuaNmX0QB1Yok6rala//ihxoCShEE4Iy7P269N+prfaVule8 Zv2OYp20b17Wbq+lCbKJGkg+gPSZqZ3P6Dm7FDXX9iU9LUvMeATKY1FSsaHyD/qCUrTs huE2uH7eiZ40QHIQCaLSqXLvfU7rHnTex7kcU29xWfo0JNAQ2LBfZPgM1HfjuirCXMQQ ntXcNjHH1qreuslDumF/3hEJEElPJubR0vrXfBkhlmnWQnSZ8N0Fl9fLwqwKrBDKWyN/ /7LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=I+o8yLfAxCl7jvK1vvUhdCXw/bHSIBQ/d1Sk8reh1yA=; b=gIPOiXPjrk8tatI4KarMDLXC0wAwNnyJwtMgENNFaxm5LlIxigWMvdRW6EV7f7YBSR W72i2hrwwZ/++Lwx7NgoX+vC8C3cctbg/V9m5VrPEUjo50AGNyMZ64xcnl4d2C+kgx50 Zp12IEi6PzAle3RXEu6PI7dPM0vmwcOHDsVW1JoHCdF6Ycz2GHfEzwcSWXGSv/KAaKtZ fyZlS5U41HAHTVc2LL1bv5tS04mQHU8FURIZlMZgzxMTJwMcvvh9OjsQhFI1IdS59y+k gcwQiScNkPu6I77LS3XPAjpNGe81qgd65vB9FyQ6241/ZPk3HwhykaDZ8PO8KWYPDuk5 G5qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=DDv9Sh22; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay8-v6si4448796plb.244.2018.05.16.23.19.36; Wed, 16 May 2018 23:19:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=DDv9Sh22; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752133AbeEQGTK (ORCPT + 99 others); Thu, 17 May 2018 02:19:10 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:24362 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750825AbeEQGS4 (ORCPT ); Thu, 17 May 2018 02:18:56 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id w4H6HbU3002841; Thu, 17 May 2018 15:17:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com w4H6HbU3002841 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1526537863; bh=I+o8yLfAxCl7jvK1vvUhdCXw/bHSIBQ/d1Sk8reh1yA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DDv9Sh22vlARVGc8MP3HF8ozBpVH8/3vduR9Ri/fkF/VtkcV+hpG/ztQ1vUQ0jNTx Z115Ojg2g2DJOUInt2kU2o4pD6uwLRZhyQfAB/fpGgDw2AKjgcmEaZ59l3paOMAxEq /C6eLKTGODkrY91+srwkh7WXcpQa9rOBePioEHrBUe5csa2zY8SybAJgftQB/iRbZh ea8jRVehOXJriMJW9nhH3LUSborPMPqnzA61aRY1ysDE9zkBZCWvBy6whhzFmTUFHV 2jyu6sHORG2Br+gMHrDA+s/WTVSoknnmPI81k6glbdWZiMytoNe34xsjUwkOR6sK+k xLCiKR9k9Q0/w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Linus Torvalds , Sam Ravnborg , Ulf Magnusson , "Luis R . Rodriguez" , linux-kernel@vger.kernel.org, Nicholas Piggin , Kees Cook , Emese Revfy , x86@kernel.org, Masahiro Yamada Subject: [PATCH v4 05/31] kconfig: remove string expansion for mainmenu after yyparse() Date: Thu, 17 May 2018 15:16:44 +0900 Message-Id: <1526537830-22606-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526537830-22606-1-git-send-email-yamada.masahiro@socionext.com> References: <1526537830-22606-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Kees Cook Reviewed-by: Ulf Magnusson --- Changes in v4: None Changes in v3: None Changes in v2: - Simplify the patch. Just remove the text expansion. scripts/kconfig/zconf.y | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 3a4a0fa..22e318c 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -109,7 +109,7 @@ static struct menu *current_menu, *current_entry; %% input: nl start | start; -start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list; +start: mainmenu_stmt stmt_list | stmt_list; /* mainmenu entry */ @@ -118,19 +118,6 @@ mainmenu_stmt: T_MAINMENU prompt nl 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: /* empty */ | stmt_list common_stmt @@ -528,7 +515,6 @@ word_opt: /* empty */ { $$ = NULL; } void conf_parse(const char *name) { - const char *tmp; struct symbol *sym; int i; @@ -544,10 +530,10 @@ void conf_parse(const char *name) if (!modules_sym) modules_sym = sym_find( "n" ); - tmp = rootmenu.prompt->text; - rootmenu.prompt->text = _(rootmenu.prompt->text); - rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); - free((char*)tmp); + if (!menu_has_prompt(&rootmenu)) { + current_entry = &rootmenu; + menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); + } menu_finalize(&rootmenu); for_all_symbols(i, sym) { -- 2.7.4