diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-07-05 11:35:48 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-07-05 11:35:48 -0700 |
commit | 38182d901d030c7d65f4aa7a49b583afb30eb9b7 (patch) | |
tree | a69e1a571495d6ca1c034359d7c995639774ab9b /src/xmenu.c | |
parent | 6dd5a677dbf794eedaa8325c46d57ac041373361 (diff) | |
download | emacs-38182d901d030c7d65f4aa7a49b583afb30eb9b7.tar.gz |
More xmalloc and related cleanup.
* alloc.c, bidi.c, buffer.c, buffer.h, bytecode.c, callint.c:
* callproc.c, charset.c, coding.c, composite.c, data.c, dispnew.c:
* doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fns.c:
* font.c, fontset.c, frame.c, fringe.c, ftfont.c, ftxfont.c, gmalloc.c:
* gtkutil.c, image.c, keyboard.c, keymap.c, lread.c, macros.c, menu.c:
* nsfns.m, nsfont.m, nsmenu.m, nsterm.m, print.c, process.c, ralloc.c:
* regex.c, region-cache.c, scroll.c, search.c, sound.c, syntax.c:
* sysdep.c, term.c, termcap.c, unexmacosx.c, window.c, xdisp.c:
* xfaces.c, xfns.c, xftfont.c, xgselect.c, xmenu.c, xrdb.c, xselect.c:
* xterm.c:
Omit needless casts involving void * pointers and allocation.
Prefer "P = xmalloc (sizeof *P)" to "P = xmalloc (sizeof (TYPE_OF_P))",
as the former is more robust if P's type is changed.
Prefer xzalloc to xmalloc + memset 0.
Simplify malloc-or-realloc to realloc.
Don't worry about xmalloc returning a null pointer.
Prefer xstrdup to xmalloc + strcpy.
* editfns.c (Fmessage_box): Grow message_text by at least 80 when
growing it.
* keyboard.c (apply_modifiers_uncached): Prefer local array to
alloca of a constant.
Diffstat (limited to 'src/xmenu.c')
-rw-r--r-- | src/xmenu.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index b7dd547737d..5a6390449c4 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -980,8 +980,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) ptrdiff_t specpdl_count = SPECPDL_INDEX (); int previous_menu_items_used = f->menu_bar_items_used; Lisp_Object *previous_items - = (Lisp_Object *) alloca (previous_menu_items_used - * sizeof (Lisp_Object)); + = alloca (previous_menu_items_used * sizeof *previous_items); int subitems; /* If we are making a new widget, its contents are empty, @@ -1028,10 +1027,11 @@ 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 + 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)); + submenu_start = alloca ((subitems + 1) * sizeof *submenu_start); + submenu_end = alloca (subitems * sizeof *submenu_end); + submenu_n_panes = alloca (subitems * sizeof *submenu_n_panes); + submenu_top_level_items = alloca (subitems + * sizeof *submenu_top_level_items); init_menu_items (); for (i = 0; i < subitems; i++) { @@ -1639,9 +1639,9 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, int i; widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; widget_value **submenu_stack - = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); + = alloca (menu_items_used * sizeof *submenu_stack); Lisp_Object *subprefix_stack - = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object)); + = alloca (menu_items_used * sizeof *subprefix_stack); int submenu_depth = 0; int first_pane; @@ -2416,7 +2416,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, { /* if alloca is fast, use that to make the space, to reduce gc needs. */ - item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1); + item_data = alloca (maxwidth + SBYTES (descrip) + 1); memcpy (item_data, SSDATA (item_name), SBYTES (item_name)); for (j = SCHARS (item_name); j < maxwidth; j++) item_data[j] = ' '; |