summaryrefslogtreecommitdiff
path: root/scripts/lxdialog/menubox.c
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2005-11-19 22:17:55 +0100
committerSam Ravnborg <sam@mars.ravnborg.org>2005-11-19 22:17:55 +0100
commita06104af7dcf2f5bafaf18f373c8b2554cbfe014 (patch)
tree97015ab8a4bb1c97d6775c53e0e3190cc5d31da7 /scripts/lxdialog/menubox.c
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>
Diffstat (limited to 'scripts/lxdialog/menubox.c')
-rw-r--r--scripts/lxdialog/menubox.c5
1 files changed, 3 insertions, 2 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,
int selected, int hotkey)
{
int j;
- char menu_item[menu_width + 1];
+ char *menu_item = malloc(menu_width + 1);
strncpy(menu_item, item, menu_width);
menu_item[menu_width] = 0;
@@ -95,6 +95,7 @@ static void print_item(WINDOW * win, const char *item, int choice,
wmove(win, choice, item_x + 1);
wrefresh(win);
}
+ free(menu_item);
}
/*
@@ -221,7 +222,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
/*
* Find length of longest item in order to center menu.
- * Set 'choice' to default item.
+ * Set 'choice' to default item.
*/
item_x = 0;
for (i = 0; i < item_no; i++) {