diff options
| author | Paul Eggert | 2011-04-09 13:39:49 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-09 13:39:49 -0700 |
| commit | e30196164233d058f66efb342eee223f014bf69b (patch) | |
| tree | 243c8e79002ebe3d3ff9fd510d1fa9148682bbcf | |
| parent | becfa255fb1fb207fa0b5d850e8df3eb53ba0bea (diff) | |
| download | emacs-e30196164233d058f66efb342eee223f014bf69b.tar.gz emacs-e30196164233d058f66efb342eee223f014bf69b.zip | |
* xmenu.c (set_frame_menubar): Allocate smaller local vectors.
This also lets GCC 4.6.0 generate slightly better loop code.
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/xmenu.c | 21 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 86dec69e094..084f41fc974 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2011-04-09 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-04-09 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * xmenu.c (set_frame_menubar): Allocate smaller local vectors. | ||
| 4 | This also lets GCC 4.6.0 generate slightly better loop code. | ||
| 5 | |||
| 3 | * callint.c (Fcall_interactively): <, not <=, for optimization. | 6 | * callint.c (Fcall_interactively): <, not <=, for optimization. |
| 4 | (Fcall_interactively): Count the number of arguments produced, | 7 | (Fcall_interactively): Count the number of arguments produced, |
| 5 | not the number of arguments given. This is simpler and lets GCC | 8 | not the number of arguments given. This is simpler and lets GCC |
diff --git a/src/xmenu.c b/src/xmenu.c index dbf8145f737..b1f7dfb26bc 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -966,6 +966,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 966 | Lisp_Object *previous_items | 966 | Lisp_Object *previous_items |
| 967 | = (Lisp_Object *) alloca (previous_menu_items_used | 967 | = (Lisp_Object *) alloca (previous_menu_items_used |
| 968 | * sizeof (Lisp_Object)); | 968 | * sizeof (Lisp_Object)); |
| 969 | EMACS_UINT subitems; | ||
| 969 | 970 | ||
| 970 | /* If we are making a new widget, its contents are empty, | 971 | /* If we are making a new widget, its contents are empty, |
| 971 | do always reinitialize them. */ | 972 | do always reinitialize them. */ |
| @@ -1010,21 +1011,21 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 1010 | 1011 | ||
| 1011 | menu_items = f->menu_bar_vector; | 1012 | menu_items = f->menu_bar_vector; |
| 1012 | menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; | 1013 | menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; |
| 1013 | submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 1014 | subitems = XVECTOR (items)->size / 4; |
| 1014 | submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 1015 | submenu_start = (int *) alloca (subitems * sizeof (int *)); |
| 1015 | submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int)); | 1016 | submenu_end = (int *) alloca (subitems * sizeof (int *)); |
| 1016 | submenu_top_level_items | 1017 | submenu_n_panes = (int *) alloca (subitems * sizeof (int)); |
| 1017 | = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 1018 | submenu_top_level_items = (int *) alloca (subitems * sizeof (int *)); |
| 1018 | init_menu_items (); | 1019 | init_menu_items (); |
| 1019 | for (i = 0; i < XVECTOR (items)->size; i += 4) | 1020 | for (i = 0; i < subitems; i++) |
| 1020 | { | 1021 | { |
| 1021 | Lisp_Object key, string, maps; | 1022 | Lisp_Object key, string, maps; |
| 1022 | 1023 | ||
| 1023 | last_i = i; | 1024 | last_i = i; |
| 1024 | 1025 | ||
| 1025 | key = XVECTOR (items)->contents[i]; | 1026 | key = XVECTOR (items)->contents[4 * i]; |
| 1026 | string = XVECTOR (items)->contents[i + 1]; | 1027 | string = XVECTOR (items)->contents[4 * i + 1]; |
| 1027 | maps = XVECTOR (items)->contents[i + 2]; | 1028 | maps = XVECTOR (items)->contents[4 * i + 2]; |
| 1028 | if (NILP (string)) | 1029 | if (NILP (string)) |
| 1029 | break; | 1030 | break; |
| 1030 | 1031 | ||
| @@ -1051,7 +1052,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 1051 | wv->help = Qnil; | 1052 | wv->help = Qnil; |
| 1052 | first_wv = wv; | 1053 | first_wv = wv; |
| 1053 | 1054 | ||
| 1054 | for (i = 0; i < last_i; i += 4) | 1055 | for (i = 0; i < last_i; i++) |
| 1055 | { | 1056 | { |
| 1056 | menu_items_n_panes = submenu_n_panes[i]; | 1057 | menu_items_n_panes = submenu_n_panes[i]; |
| 1057 | wv = digest_single_submenu (submenu_start[i], submenu_end[i], | 1058 | wv = digest_single_submenu (submenu_start[i], submenu_end[i], |