kconfig: remove CONFIG_ from string constants
authorYann E. MORIN <yann.morin.1998@free.fr>
Fri, 19 Oct 2012 23:06:23 +0000 (01:06 +0200)
committerMichal Marek <mmarek@suse.cz>
Tue, 20 Nov 2012 10:20:08 +0000 (11:20 +0100)
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>
scripts/kconfig/mconf.c
scripts/kconfig/nconf.c

index 48f67448af7b67cf6c8df7394702a65767891992..5f29618d1845c534a39975a45a74ae25b1ba33ed 100644 (file)
@@ -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 @@ again:
                show_helptext(_("Search Configuration"), search_help);
                goto again;
        default:
+               str_free(&title);
                return;
        }
 
@@ -398,6 +403,7 @@ again:
                str_free(&res);
        } while (again);
        free(sym_arr);
+       str_free(&title);
 }
 
 static void build_conf(struct menu *menu)
index 87d4b15da951031896868789df7a992d21fcc73b..261f926d8f4b28ec6f1d4d5a1de8b89491b1cac1 100644 (file)
@@ -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 @@ again:
                                _("Search Configuration"), search_help);
                goto again;
        default:
+               str_free(&title);
                return;
        }
 
@@ -726,6 +732,7 @@ again:
        show_scroll_win(main_window,
                        _("Search Results"), str_get(&res));
        str_free(&res);
+       str_free(&title);
 }