2011-04-09 Paul Eggert <eggert@cs.ucla.edu>
+ * xmenu.c (set_frame_menubar): Allocate smaller local vectors.
+ This also lets GCC 4.6.0 generate slightly better loop code.
+
* callint.c (Fcall_interactively): <, not <=, for optimization.
(Fcall_interactively): Count the number of arguments produced,
not the number of arguments given. This is simpler and lets GCC
Lisp_Object *previous_items
= (Lisp_Object *) alloca (previous_menu_items_used
* sizeof (Lisp_Object));
+ EMACS_UINT subitems;
/* If we are making a new widget, its contents are empty,
do always reinitialize them. */
menu_items = f->menu_bar_vector;
menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
- submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
- submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
- submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int));
- submenu_top_level_items
- = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
+ subitems = XVECTOR (items)->size / 4;
+ submenu_start = (int *) alloca (subitems * 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 *));
init_menu_items ();
- for (i = 0; i < XVECTOR (items)->size; i += 4)
+ for (i = 0; i < subitems; i++)
{
Lisp_Object key, string, maps;
last_i = i;
- key = XVECTOR (items)->contents[i];
- string = XVECTOR (items)->contents[i + 1];
- maps = XVECTOR (items)->contents[i + 2];
+ key = XVECTOR (items)->contents[4 * i];
+ string = XVECTOR (items)->contents[4 * i + 1];
+ maps = XVECTOR (items)->contents[4 * i + 2];
if (NILP (string))
break;
wv->help = Qnil;
first_wv = wv;
- for (i = 0; i < last_i; i += 4)
+ for (i = 0; i < last_i; i++)
{
menu_items_n_panes = submenu_n_panes[i];
wv = digest_single_submenu (submenu_start[i], submenu_end[i],