summaryrefslogtreecommitdiff
path: root/src/gmalloc.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-07-05 11:35:48 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-07-05 11:35:48 -0700
commit38182d901d030c7d65f4aa7a49b583afb30eb9b7 (patch)
treea69e1a571495d6ca1c034359d7c995639774ab9b /src/gmalloc.c
parent6dd5a677dbf794eedaa8325c46d57ac041373361 (diff)
downloademacs-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/gmalloc.c')
-rw-r--r--src/gmalloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 3de3733d55f..3739214bc46 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -1616,7 +1616,7 @@ memalign (size_t alignment, size_t size)
break;
if (l == NULL)
{
- l = malloc (sizeof (struct alignlist));
+ l = malloc (sizeof *l);
if (l != NULL)
{
l->next = _aligned_blocks;
@@ -1811,7 +1811,7 @@ mallochook (size_t size)
struct hdr *hdr;
__malloc_hook = old_malloc_hook;
- hdr = malloc (sizeof (struct hdr) + size + 1);
+ hdr = malloc (sizeof *hdr + size + 1);
__malloc_hook = mallochook;
if (hdr == NULL)
return NULL;
@@ -1842,7 +1842,7 @@ reallochook (void *ptr, size_t size)
__free_hook = old_free_hook;
__malloc_hook = old_malloc_hook;
__realloc_hook = old_realloc_hook;
- hdr = realloc (hdr, sizeof (struct hdr) + size + 1);
+ hdr = realloc (hdr, sizeof *hdr + size + 1);
__free_hook = freehook;
__malloc_hook = mallochook;
__realloc_hook = reallochook;