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 <[email protected]>
diff --git a/scripts/lxdialog/menubox.c b/scripts/lxdialog/menubox.c
index 260cc4d..ff3a617 100644
--- a/scripts/lxdialog/menubox.c
+++ b/scripts/lxdialog/menubox.c
@@ -65,11 +65,11 @@ static int menu_width, item_x;
*/
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;
j = first_alpha(menu_item, "YyNnMmHh");
@@ -93,10 +93,11 @@ static void print_item(WINDOW * win, con
}
if (selected) {
wmove(win, choice, item_x + 1);
wrefresh(win);
}
+ free(menu_item);
}
/*
* Print the scroll indicators.
*/
@@ -219,11 +220,11 @@ int dialog_menu(const char *title, const
draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2,
menubox_border_attr, menubox_attr);
/*
* 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++) {
item_x =
MAX(item_x, MIN(menu_width, strlen(items[i * 2 + 1]) + 2));
diff --git a/scripts/lxdialog/util.c b/scripts/lxdialog/util.c
index 1f84809..ce41147 100644
--- a/scripts/lxdialog/util.c
+++ b/scripts/lxdialog/util.c
@@ -24,12 +24,10 @@
/* use colors by default? */
bool use_colors = 1;
const char *backtitle = NULL;
-const char *dialog_result;
-
/*
* Attribute values, default is for mono display
*/
chtype attributes[] = {
A_NORMAL, /* screen_attr */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]