summaryrefslogtreecommitdiff
path: root/src/xmenu.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-05-12 09:16:40 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-05-12 09:16:40 -0700
commit3e26f69c4f5f7fe38081f0889186d6a9260c85e0 (patch)
treedc59eb2bb91f499ee07a432dc0d2ffebae6213f6 /src/xmenu.c
parent5cc152c0804748eb4c872ff34fe5414669e10745 (diff)
downloademacs-3e26f69c4f5f7fe38081f0889186d6a9260c85e0.tar.gz
* xmenu.c (set_frame_menubar): Use int, not EMACS_UINT, for indexes
that always fit in int. Use a sentinel instead of a counter, to avoid a temp and to allay GCC's concerns about possible int overflow.
Diffstat (limited to 'src/xmenu.c')
-rw-r--r--src/xmenu.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index 898aade06c2..ccb60d2dcbb 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -922,7 +922,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
#endif
Lisp_Object items;
widget_value *wv, *first_wv, *prev_wv = 0;
- EMACS_UINT i, last_i;
+ int i;
int *submenu_start, *submenu_end;
int *submenu_top_level_items, *submenu_n_panes;
@@ -966,7 +966,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
Lisp_Object *previous_items
= (Lisp_Object *) alloca (previous_menu_items_used
* sizeof (Lisp_Object));
- EMACS_UINT subitems;
+ int subitems;
/* If we are making a new widget, its contents are empty,
do always reinitialize them. */
@@ -1012,7 +1012,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
menu_items = f->menu_bar_vector;
menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
subitems = ASIZE (items) / 4;
- submenu_start = (int *) alloca (subitems * sizeof (int));
+ submenu_start = (int *) alloca ((subitems + 1) * sizeof (int));
submenu_end = (int *) alloca (subitems * sizeof (int));
submenu_n_panes = (int *) alloca (subitems * sizeof (int));
submenu_top_level_items = (int *) alloca (subitems * sizeof (int));
@@ -1037,7 +1037,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
submenu_end[i] = menu_items_used;
}
- last_i = i;
+ submenu_start[i] = -1;
finish_menu_items ();
/* Convert menu_items into widget_value trees
@@ -1051,7 +1051,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
wv->help = Qnil;
first_wv = wv;
- for (i = 0; i < last_i; i++)
+ for (i = 0; 0 <= submenu_start[i]; i++)
{
menu_items_n_panes = submenu_n_panes[i];
wv = digest_single_submenu (submenu_start[i], submenu_end[i],