int dispwidth, dispheight;
int i, j, lines, maxlines;
int maxwidth;
- ptrdiff_t specpdl_count = SPECPDL_INDEX ();
+ ptrdiff_t specpdl_count;
- if (! FRAME_TERMCAP_P (f))
- emacs_abort ();
+ eassert (FRAME_TERMCAP_P (f));
*error_name = 0;
if (menu_items_n_panes == 0)
/* Don't GC while we prepare and show the menu, because we give the
menu functions pointers to the contents of strings. */
- inhibit_garbage_collection ();
+ specpdl_count = inhibit_garbage_collection ();
/* Adjust coordinates to be root-window-relative. */
item_x = x += f->left_pos;
{
tty_menu_destroy (menu);
*error_name = "Can't create pane";
- return Qnil;
+ entry = Qnil;
+ goto tty_menu_end;
}
i += MENU_ITEMS_PANE_LENGTH;
{
tty_menu_destroy (menu);
*error_name = "Can't add selection to menu";
- return Qnil;
+ entry = Qnil;
+ goto tty_menu_end;
}
i += MENU_ITEMS_ITEM_LENGTH;
lines++;
x = max (x, 1);
y = max (y, 1);
tty_menu_locate (menu, x, y, &ulx, &uly, &width, &height);
- if (ulx+width > dispwidth)
+ if (ulx + width > dispwidth)
{
x -= (ulx + width) - dispwidth;
ulx = dispwidth - width;
}
- if (uly+height > dispheight)
+ if (uly + height > dispheight)
{
y -= (uly + height) - dispheight;
uly = dispheight - height;
break;
}
- unbind_to (specpdl_count, Qnil);
+ tty_menu_end:
+ unbind_to (specpdl_count, Qnil);
return entry;
}