From 38182d901d030c7d65f4aa7a49b583afb30eb9b7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 5 Jul 2012 11:35:48 -0700 Subject: 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. --- src/bytecode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index 08a02ea921d..e1363d390e8 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -488,8 +488,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, stack.constants = vector; if (MAX_ALLOCA / sizeof (Lisp_Object) <= XFASTINT (maxdepth)) memory_full (SIZE_MAX); - top = (Lisp_Object *) alloca ((XFASTINT (maxdepth) + 1) - * sizeof (Lisp_Object)); + top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top); #if BYTE_MAINTAIN_TOP stack.bottom = top + 1; stack.top = NULL; -- cgit v1.2.1