Skip to content

Commit 337a275

Browse files
yann-morin-1998michal42
authored andcommitted
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" <yann.morin.1998@free.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent 7d5bb96 commit 337a275

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎scripts/kconfig/mconf.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,19 @@ static void search_conf(void)
348348
{
349349
struct symbol **sym_arr;
350350
struct gstr res;
351+
struct gstr title;
351352
char *dialog_input;
352353
int dres, vscroll = 0, hscroll = 0;
353354
bool again;
354355

356+
title = str_new();
357+
str_printf( &title, _("Enter %s (sub)string to search for "
358+
"(with or without \"%s\")"), CONFIG_, CONFIG_);
359+
355360
again:
356361
dialog_clear();
357362
dres = dialog_inputbox(_("Search Configuration Parameter"),
358-
_("Enter " CONFIG_ " (sub)string to search for "
359-
"(with or without \"" CONFIG_ "\")"),
363+
str_get(&title),
360364
10, 75, "");
361365
switch (dres) {
362366
case 0:
@@ -365,6 +369,7 @@ static void search_conf(void)
365369
show_helptext(_("Search Configuration"), search_help);
366370
goto again;
367371
default:
372+
str_free(&title);
368373
return;
369374
}
370375

@@ -398,6 +403,7 @@ static void search_conf(void)
398403
str_free(&res);
399404
} while (again);
400405
free(sym_arr);
406+
str_free(&title);
401407
}
402408

403409
static void build_conf(struct menu *menu)

‎scripts/kconfig/nconf.c‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,13 +696,18 @@ static void search_conf(void)
696696
{
697697
struct symbol **sym_arr;
698698
struct gstr res;
699+
struct gstr title;
699700
char *dialog_input;
700701
int dres;
702+
703+
title = str_new();
704+
str_printf( &title, _("Enter %s (sub)string to search for "
705+
"(with or without \"%s\")"), CONFIG_, CONFIG_);
706+
701707
again:
702708
dres = dialog_inputbox(main_window,
703709
_("Search Configuration Parameter"),
704-
_("Enter " CONFIG_ " (sub)string to search for "
705-
"(with or without \"" CONFIG_ "\")"),
710+
str_get(&title),
706711
"", &dialog_input_result, &dialog_input_result_len);
707712
switch (dres) {
708713
case 0:
@@ -712,6 +717,7 @@ static void search_conf(void)
712717
_("Search Configuration"), search_help);
713718
goto again;
714719
default:
720+
str_free(&title);
715721
return;
716722
}
717723

@@ -726,6 +732,7 @@ static void search_conf(void)
726732
show_scroll_win(main_window,
727733
_("Search Results"), str_get(&res));
728734
str_free(&res);
735+
str_free(&title);
729736
}
730737

731738

0 commit comments

Comments
 (0)