aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2005-11-19 16:17:55 -0500
committerSam Ravnborg <sam@mars.ravnborg.org>2005-11-19 16:17:55 -0500
commita06104af7dcf2f5bafaf18f373c8b2554cbfe014 (patch)
tree97015ab8a4bb1c97d6775c53e0e3190cc5d31da7
parentdec69da856653772d7ee7b2f98dc69da27274a22 (diff)
kconfig: lxdialog is now sparse clean
Replacing a gcc idiom with malloc and deleting an unused global variable made lxdialog sparse clean. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
-rw-r--r--scripts/lxdialog/menubox.c5
-rw-r--r--scripts/lxdialog/util.c2
2 files changed, 3 insertions, 4 deletions
diff --git a/scripts/lxdialog/menubox.c b/scripts/lxdialog/menubox.c
index 260cc4dd5dab..ff3a6179833d 100644
--- a/scripts/lxdialog/menubox.c
+++ b/scripts/lxdialog/menubox.c
@@ -67,7 +67,7 @@ static void print_item(WINDOW * win, const char *item, int choice,
67 int selected, int hotkey) 67 int selected, int hotkey)
68{ 68{
69 int j; 69 int j;
70 char menu_item[menu_width + 1]; 70 char *menu_item = malloc(menu_width + 1);
71 71
72 strncpy(menu_item, item, menu_width); 72 strncpy(menu_item, item, menu_width);
73 menu_item[menu_width] = 0; 73 menu_item[menu_width] = 0;
@@ -95,6 +95,7 @@ static void print_item(WINDOW * win, const char *item, int choice,
95 wmove(win, choice, item_x + 1); 95 wmove(win, choice, item_x + 1);
96 wrefresh(win); 96 wrefresh(win);
97 } 97 }
98 free(menu_item);
98} 99}
99 100
100/* 101/*
@@ -221,7 +222,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
221 222
222 /* 223 /*
223 * Find length of longest item in order to center menu. 224 * Find length of longest item in order to center menu.
224 * Set 'choice' to default item. 225 * Set 'choice' to default item.
225 */ 226 */
226 item_x = 0; 227 item_x = 0;
227 for (i = 0; i < item_no; i++) { 228 for (i = 0; i < item_no; i++) {
diff --git a/scripts/lxdialog/util.c b/scripts/lxdialog/util.c
index 1f84809773f0..ce411474d729 100644
--- a/scripts/lxdialog/util.c
+++ b/scripts/lxdialog/util.c
@@ -26,8 +26,6 @@ bool use_colors = 1;
26 26
27const char *backtitle = NULL; 27const char *backtitle = NULL;
28 28
29const char *dialog_result;
30
31/* 29/*
32 * Attribute values, default is for mono display 30 * Attribute values, default is for mono display
33 */ 31 */