diff options
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/term.c b/src/term.c index af1b62ccaaf..0a1b3dd13e2 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -3191,6 +3191,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3191 | Lisp_Object selectface; | 3191 | Lisp_Object selectface; |
| 3192 | int first_item = 0; | 3192 | int first_item = 0; |
| 3193 | int col, row; | 3193 | int col, row; |
| 3194 | USE_SAFE_ALLOCA; | ||
| 3194 | 3195 | ||
| 3195 | /* Don't allow non-positive x0 and y0, lest the menu will wrap | 3196 | /* Don't allow non-positive x0 and y0, lest the menu will wrap |
| 3196 | around the display. */ | 3197 | around the display. */ |
| @@ -3199,7 +3200,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3199 | if (y0 <= 0) | 3200 | if (y0 <= 0) |
| 3200 | y0 = 1; | 3201 | y0 = 1; |
| 3201 | 3202 | ||
| 3202 | state = alloca (menu->panecount * sizeof (struct tty_menu_state)); | 3203 | SAFE_NALLOCA (state, 1, menu->panecount); |
| 3203 | memset (state, 0, sizeof (*state)); | 3204 | memset (state, 0, sizeof (*state)); |
| 3204 | faces[0] | 3205 | faces[0] |
| 3205 | = lookup_derived_face (sf, intern ("tty-menu-disabled-face"), | 3206 | = lookup_derived_face (sf, intern ("tty-menu-disabled-face"), |
| @@ -3421,6 +3422,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3421 | discard_mouse_events (); | 3422 | discard_mouse_events (); |
| 3422 | if (!kbd_buffer_events_waiting ()) | 3423 | if (!kbd_buffer_events_waiting ()) |
| 3423 | clear_input_pending (); | 3424 | clear_input_pending (); |
| 3425 | SAFE_FREE (); | ||
| 3424 | return result; | 3426 | return result; |
| 3425 | } | 3427 | } |
| 3426 | 3428 | ||
| @@ -3606,6 +3608,7 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 3606 | item_y = y += f->top_pos; | 3608 | item_y = y += f->top_pos; |
| 3607 | 3609 | ||
| 3608 | /* Create all the necessary panes and their items. */ | 3610 | /* Create all the necessary panes and their items. */ |
| 3611 | USE_SAFE_ALLOCA; | ||
| 3609 | maxwidth = maxlines = lines = i = 0; | 3612 | maxwidth = maxlines = lines = i = 0; |
| 3610 | lpane = TTYM_FAILURE; | 3613 | lpane = TTYM_FAILURE; |
| 3611 | while (i < menu_items_used) | 3614 | while (i < menu_items_used) |
| @@ -3674,9 +3677,7 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 3674 | 3677 | ||
| 3675 | if (!NILP (descrip)) | 3678 | if (!NILP (descrip)) |
| 3676 | { | 3679 | { |
| 3677 | /* If alloca is fast, use that to make the space, | 3680 | item_data = SAFE_ALLOCA (maxwidth + SBYTES (descrip) + 1); |
| 3678 | to reduce gc needs. */ | ||
| 3679 | item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1); | ||
| 3680 | memcpy (item_data, SSDATA (item_name), SBYTES (item_name)); | 3681 | memcpy (item_data, SSDATA (item_name), SBYTES (item_name)); |
| 3681 | for (j = SCHARS (item_name); j < maxwidth; j++) | 3682 | for (j = SCHARS (item_name); j < maxwidth; j++) |
| 3682 | item_data[j] = ' '; | 3683 | item_data[j] = ' '; |
| @@ -3829,6 +3830,7 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 3829 | 3830 | ||
| 3830 | tty_menu_end: | 3831 | tty_menu_end: |
| 3831 | 3832 | ||
| 3833 | SAFE_FREE (); | ||
| 3832 | unbind_to (specpdl_count, Qnil); | 3834 | unbind_to (specpdl_count, Qnil); |
| 3833 | return entry; | 3835 | return entry; |
| 3834 | } | 3836 | } |