Replacing a gcc idiom with malloc and deleting an unused global variable made lxdialog sparse clean.
Showing the changes to scripts (2 of 2 files). Show all
Unified · Split
| @@ -67,7 +67,7 @@ static void print_item(WINDOW * win, const char *item, int choice, · 66 unmodified lines | ||
| 67 | 67 | int selected, int hotkey) |
| 68 | 68 | { |
| 69 | 69 | int j; |
| 70 | − char menu_item[menu_width + 1]; | |
| 70 | + char *menu_item = malloc(menu_width + 1); | |
| 71 | 71 | |
| 72 | 72 | strncpy(menu_item, item, menu_width); |
| 73 | 73 | menu_item[menu_width] = 0; |
| @@ -95,6 +95,7 @@ static void print_item(WINDOW * win, const char *item, int choice, · 21 unmodified lines | ||
| 95 | 95 | wmove(win, choice, item_x + 1); |
| 96 | 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, · 120 unmodified lines | ||
| 221 | 222 | |
| 222 | 223 | /* |
| 223 | 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 | 227 | item_x = 0; |
| 227 | 228 | for (i = 0; i < item_no; i++) { |
| @@ -26,8 +26,6 @@ bool use_colors = 1; · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | const char *backtitle = NULL; |
| 28 | 28 | |
| 29 | −const char *dialog_result; | |
| 30 | − | |
| 31 | 29 | /* |
| 32 | 30 | * Attribute values, default is for mono display |
| 33 | 31 | */ |