From 337a275d03e0b900dc8ac3ab5583d18099fedae6 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sat, 20 Oct 2012 01:06:23 +0200 Subject: [PATCH] kconfig: remove CONFIG_ from string constants Having the CONFIG_ prefix in string constants gets in the way of using a run-time-defined CONFIG_ prefix. Fix that by using temp growable strings (gstr) in which we printf the text. Signed-off-by: "Yann E. MORIN" Signed-off-by: Michal Marek --- scripts/kconfig/mconf.c | 10 ++++++++-- scripts/kconfig/nconf.c | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 48f67448af7b..5f29618d1845 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -348,15 +348,19 @@ static void search_conf(void) { struct symbol **sym_arr; struct gstr res; + struct gstr title; char *dialog_input; int dres, vscroll = 0, hscroll = 0; bool again; + title = str_new(); + str_printf( &title, _("Enter %s (sub)string to search for " + "(with or without \"%s\")"), CONFIG_, CONFIG_); + again: dialog_clear(); dres = dialog_inputbox(_("Search Configuration Parameter"), - _("Enter " CONFIG_ " (sub)string to search for " - "(with or without \"" CONFIG_ "\")"), + str_get(&title), 10, 75, ""); switch (dres) { case 0: @@ -365,6 +369,7 @@ static void search_conf(void) show_helptext(_("Search Configuration"), search_help); goto again; default: + str_free(&title); return; } @@ -398,6 +403,7 @@ static void search_conf(void) str_free(&res); } while (again); free(sym_arr); + str_free(&title); } static void build_conf(struct menu *menu) diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 87d4b15da951..261f926d8f4b 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -696,13 +696,18 @@ static void search_conf(void) { struct symbol **sym_arr; struct gstr res; + struct gstr title; char *dialog_input; int dres; + + title = str_new(); + str_printf( &title, _("Enter %s (sub)string to search for " + "(with or without \"%s\")"), CONFIG_, CONFIG_); + again: dres = dialog_inputbox(main_window, _("Search Configuration Parameter"), - _("Enter " CONFIG_ " (sub)string to search for " - "(with or without \"" CONFIG_ "\")"), + str_get(&title), "", &dialog_input_result, &dialog_input_result_len); switch (dres) { case 0: @@ -712,6 +717,7 @@ static void search_conf(void) _("Search Configuration"), search_help); goto again; default: + str_free(&title); return; } @@ -726,6 +732,7 @@ static void search_conf(void) show_scroll_win(main_window, _("Search Results"), str_get(&res)); str_free(&res); + str_free(&title); }