diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 2 | ||||
-rw-r--r-- | src/gmalloc.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fdb4b24233f..2a5c828578f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -16,6 +16,8 @@ 2013-11-08 Paul Eggert <eggert@cs.ucla.edu> + * gmalloc.c (special_realloc, calloc, mallochook): Use tail calls. + * chartab.c (make_sub_char_table): Fix size typo (Bug#15825). This bug was introduced in my 2013-06-21 change, and caused struct Lisp_Sub_Char_Table objects to be given too many slots, diff --git a/src/gmalloc.c b/src/gmalloc.c index fc728eeea7e..c50df25cd41 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c @@ -1307,8 +1307,8 @@ special_realloc (void *ptr, size_t size) type == 0 ? bss_sbrk_heapinfo[block].busy.info.size * BLOCKSIZE : (size_t) 1 << type; result = _malloc_internal_nolock (size); - if (result != NULL) - memcpy (result, ptr, min (oldsize, size)); + if (result) + return memcpy (result, ptr, min (oldsize, size)); return result; } #endif @@ -1501,7 +1501,7 @@ calloc (size_t nmemb, size_t size) result = malloc (bytes); if (result) - memset (result, 0, bytes); + return memset (result, 0, bytes); return result; } /* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. @@ -1814,8 +1814,7 @@ mallochook (size_t size) hdr->size = size; hdr->magic = MAGICWORD; ((char *) &hdr[1])[size] = MAGICBYTE; - memset (hdr + 1, MALLOCFLOOD, size); - return hdr + 1; + return memset (hdr + 1, MALLOCFLOOD, size); } static void * |