aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorPaul Eggert2018-06-14 15:59:08 -0700
committerPaul Eggert2018-06-14 17:13:38 -0700
commit3f0a8a2e14669cf4a1f56e97f8b1299fced79796 (patch)
treedd5b4d0154a5be7ee9a04b3fcfdaa6689935b56a /src/term.c
parent12fd59bba0b04fb6727f4fa54e3305a65fae1d44 (diff)
downloademacs-3f0a8a2e14669cf4a1f56e97f8b1299fced79796.tar.gz
emacs-3f0a8a2e14669cf4a1f56e97f8b1299fced79796.zip
Use record_unwind_protect_ptr to avoid allocation
* src/term.c (struct tty_pop_down_menu): New type. (tty_pop_down_menu, tty_menu_show): Use it, along with record_unwind_protect_ptr, to avoid allocating a Lisp_Misc. * src/xmenu.c (struct pop_down_menu): New type. (pop_down_menu, x_menu_show): Use it, likewise. * src/xterm.c (x_cr_destroy, x_cr_export_frames): Use record_unwind_protect_pointer to avoid possibly allocating a Lisp_Misc.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/term.c b/src/term.c
index bcd7dd82d6f..85bfa84d937 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3408,15 +3408,20 @@ tty_menu_help_callback (char const *help_string, int pane, int item)
3408 Qnil, menu_object, make_number (item)); 3408 Qnil, menu_object, make_number (item));
3409} 3409}
3410 3410
3411struct tty_pop_down_menu
3412{
3413 tty_menu *menu;
3414 struct buffer *buffer;
3415};
3416
3411static void 3417static void
3412tty_pop_down_menu (Lisp_Object arg) 3418tty_pop_down_menu (void *arg)
3413{ 3419{
3414 tty_menu *menu = XSAVE_POINTER (arg, 0); 3420 struct tty_pop_down_menu *data = arg;
3415 struct buffer *orig_buffer = XSAVE_POINTER (arg, 1);
3416 3421
3417 block_input (); 3422 block_input ();
3418 tty_menu_destroy (menu); 3423 tty_menu_destroy (data->menu);
3419 set_buffer_internal (orig_buffer); 3424 set_buffer_internal (data->buffer);
3420 unblock_input (); 3425 unblock_input ();
3421} 3426}
3422 3427
@@ -3697,8 +3702,9 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags,
3697 3702
3698 /* We save and restore the current buffer because tty_menu_activate 3703 /* We save and restore the current buffer because tty_menu_activate
3699 triggers redisplay, which switches buffers at will. */ 3704 triggers redisplay, which switches buffers at will. */
3700 record_unwind_protect (tty_pop_down_menu, 3705 record_unwind_protect_ptr (tty_pop_down_menu,
3701 make_save_ptr_ptr (menu, current_buffer)); 3706 &((struct tty_pop_down_menu)
3707 {menu, current_buffer}));
3702 3708
3703 specbind (Qoverriding_terminal_local_map, 3709 specbind (Qoverriding_terminal_local_map,
3704 Fsymbol_value (Qtty_menu_navigation_map)); 3710 Fsymbol_value (Qtty_menu_navigation_map));