From patchwork Mon May 28 09:21:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 137037 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2591811lji; Mon, 28 May 2018 02:24:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqN0kJoUmZifMysil+DmZ54IOtXLmK3dbdwAc2BAzxeXsxYh4dWTrarSVAD4hF8klD5FQVO X-Received: by 2002:a62:a21e:: with SMTP id m30-v6mr12825889pff.251.1527499462446; Mon, 28 May 2018 02:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527499462; cv=none; d=google.com; s=arc-20160816; b=iCq4i57Kc9BwECXFd9CZ5XwHiNWAmcAYlmSwCxQgGOGKYNpk8yFYabPl4+oc8/gyuk dxj0zm7JcnupzBSXCWoQQd3wOtJhOylz2oz3YLwap1vo5P6XxkDWE8kATsjNPGhy3uvN z9RxnTgLWEYcj7yuWWUxeO6iWSaEgfFqcYX4ubqjT7BcuK7+a2KlgnCq1OI9fe5BhWRE dRVRjLDpsH6ns2gQKcEXJda7vMd1Sq6TcYNQOcickJHd+sA8TQDVL1x2E1hcFmEDO7Wx VA5ezv+fdpemzWeGvO6GSdiHJamgc9BeO/zlyT50e+vlpKQuIgdH00CG3y+n99cgk1Xo kPUg== 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 w10-v6si2388144ply.482.2018.05.28.02.24.22; Mon, 28 May 2018 02:24:22 -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 S1754364AbeE1JYS (ORCPT + 30 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(-) -- 2.7.4 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) {