#include <config.h>
#include <stdio.h>
#include <setjmp.h>
+#include <limits.h> /* for INT_MAX */
#include "lisp.h"
#include "keyboard.h"
/* If non-nil, means that the global vars defined here are already in use.
Used to detect cases where we try to re-enter this non-reentrant code. */
+#if ! (defined USE_GTK || defined USE_MOTIF)
+static
+#endif
Lisp_Object menu_items_inuse;
/* Number of slots currently allocated in menu_items. */
static void
grow_menu_items (void)
{
+ if ((INT_MAX - MENU_ITEMS_PANE_LENGTH) / 2 < menu_items_allocated)
+ memory_full (SIZE_MAX);
menu_items_allocated *= 2;
menu_items = larger_vector (menu_items, menu_items_allocated, Qnil);
}
return;
}
-#if defined(HAVE_X_WINDOWS) || defined(MSDOS)
+#if defined (HAVE_X_WINDOWS) || defined (MSDOS)
#ifndef HAVE_BOXES
/* Simulate radio buttons and toggle boxes by putting a prefix in
front of them. */
if (!NILP (descrip))
wv->lkey = descrip;
wv->value = 0;
- /* The EMACS_INT cast avoids a warning. There's no problem
+ /* The intptr_t cast avoids a warning. There's no problem
as long as pointers have enough bits to hold small integers. */
- wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0);
+ wv->call_data = (!NILP (def) ? (void *) (intptr_t) i : 0);
wv->enabled = !NILP (enable);
if (NILP (type))
else
{
entry = XVECTOR (vector)->contents[i + MENU_ITEMS_ITEM_VALUE];
- /* The EMACS_INT cast avoids a warning. There's no problem
+ /* Treat the pointer as an integer. There's no problem
as long as pointers have enough bits to hold small integers. */
- if ((int) (EMACS_INT) client_data == i)
+ if ((intptr_t) client_data == i)
{
int j;
struct input_event buf;
prefix = entry = Qnil;
i = 0;
subprefix_stack =
- (Lisp_Object *)alloca(menu_items_used * sizeof (Lisp_Object));
+ (Lisp_Object *)alloca (menu_items_used * sizeof (Lisp_Object));
while (i < menu_items_used)
{
#else /* not HAVE_X_WINDOWS */
Lisp_Object bar_window;
enum scroll_bar_part part;
- unsigned long time;
+ Time time;
void (*mouse_position_hook) (struct frame **, int,
Lisp_Object *,
enum scroll_bar_part *,
Lisp_Object *,
Lisp_Object *,
- unsigned long *) =
+ Time *) =
FRAME_TERMINAL (new_f)->mouse_position_hook;
if (mouse_position_hook)