Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2143121imm; Mon, 28 May 2018 02:29:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpdg9av+vUfHF0hQmSocaRqdveWeoLENh7isCIJev2UqfQb8J3RG05N6XxXMODMesUzDkyV X-Received: by 2002:a17:902:a512:: with SMTP id s18-v6mr12844362plq.223.1527499787130; Mon, 28 May 2018 02:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527499787; cv=none; d=google.com; s=arc-20160816; b=GFwBnX0h1O/xmk5FVwBxzqmsY3ZxiqsKfVEzd3j2HvNxbh4IKpDLOkMzqVHe123NlU NoHn5isU0pBHweZF3drBMhYygucyCHvp4ls08RZchk6lj1MijNXlpjNWFs+2F1p0XwSl U7mh7ICmPk67SGdI6bE/zZ6QXvC7Gl36rzv8WCglvD/RFgtMcNSnHQY3M13QgByPzLhV KyTbBujM8o3NVGyBPU0DDQnsQWscwRLutF9DZUlEmAsmk8VPJBONFibzv2K2WZI21oaq th/qd90L9ZWq+/LO0RpnpO6C/QTsPUe6+JqbvE9vPq9tDCyLLjI+T6+mb9hrHC7tiYy2 xH1w== 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=a+sJfDvaiOW0y1ISbFPnFjGs0NB0UxI35ML1XjhPaaQ=; b=zSUlxwyTQN8HhQP+vXXfFWBi1toLnVV1wHFI6+xNZ6nghZdRyKKt2a/TO2+KGOXv41 +gGumJhNWWpT6+HQx+Q65sB/E+b6aa6+fnNYN/a8Xurz/drMCc5KK6cTppkBgou4LwEd mZOzVuuNjWhaV4eXQEn/7hO1I1skrBOJAFisOmc/KLwVvK8MSqSMjibK4D9xAL7i7PYG nInCMdGIQ18wcBOQlWYoEugzHpVZUCZkxUai9oxq81/YZgs4Y8Ss9xD9QSqp9TOxvK2f ikmVfDyJLjaQRQcRqEF9Gb3OLFroC4ZQZ8bnyc/ZDSwvc0wha0gOAxFPcVoXvgKIH+fZ 4ByA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=kzyXtNNG; 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 t20-v6si29455507plo.326.2018.05.28.02.29.32; Mon, 28 May 2018 02:29:47 -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=kzyXtNNG; 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 S1754354AbeE1JYS (ORCPT + 99 others); Mon, 28 May 2018 05:24:18 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:21452 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754090AbeE1JYM (ORCPT ); Mon, 28 May 2018 05:24:12 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-10.nifty.com with ESMTP id w4S9MInM027506; Mon, 28 May 2018 18:22:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com w4S9MInM027506 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1527499343; bh=a+sJfDvaiOW0y1ISbFPnFjGs0NB0UxI35ML1XjhPaaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kzyXtNNGhs+6RWZLFYwdKvSsujbn2hn4jxKOCs+RvM/NgQkpD/8K52GL06W2SO8J4 HDTkGUE4bRhvTo/RAdhZFUc3s+NlmijRdiyNxw45OtbBlemWbx0sYWbVQgrD1MM/z1 GsNEAzrwkFsU3slOL3u3U3g3JVVdI3ZiFeuC1SZO9YZntNSfkqVkuhzxvNXkGDVvnC 372xOBpJDXl9KrK2tngCsF7Kl70rhsVTW7dj7aCFDbWCoMxQxnaEjNcp3+9FkQo+bJ ElgQHU7QaZBZh5A11D8ETrca6u1sbyyXc9GwgmpVgnIywU7i69EPYBZuO6JJoF+0Wq kCaMsKYze1QTw== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Kees Cook , Nicholas Piggin , "Luis R . Rodriguez" , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Linus Torvalds , Masahiro Yamada Subject: [PATCH v5 05/31] kconfig: remove string expansion for mainmenu after yyparse() Date: Mon, 28 May 2018 18:21:42 +0900 Message-Id: <1527499328-13213-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527499328-13213-1-git-send-email-yamada.masahiro@socionext.com> References: <1527499328-13213-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 v5: None 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