diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2014-05-22 09:40:35 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2014-05-22 09:40:35 -0700 |
commit | 74fde0f44f68a14d920db4d24626984e2964368d (patch) | |
tree | ce487b5a0080a9a9abbef810f93bb19069defe95 /src/gmalloc.c | |
parent | bbd03f131a88ab1ff993bb6bba1bea93e7ee17ea (diff) | |
download | emacs-74fde0f44f68a14d920db4d24626984e2964368d.tar.gz |
Supply malloc and alloc_size attributes for extern allocators.
This documents the C API, and helps GCC generate a bit better code.
* conf_post.h (ATTRIBUTE_MALLOC, ATTRIBUTE_ALLOC_SIZE)
(ATTRIBUTE_MALLOC_SIZE): New macros.
* gmalloc.c (malloc, realloc, calloc):
* gtkutil.h (malloc_widget_value):
* lisp.h (ralloc, r_re_alloc, xmalloc, xzalloc, xrealloc, xnmalloc)
(xnrealloc, xstrdup, xlispstrdup, record_xmalloc):
Use them.
Diffstat (limited to 'src/gmalloc.c')
-rw-r--r-- | src/gmalloc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gmalloc.c b/src/gmalloc.c index 977abbdbbbd..ab1dfd07db2 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c @@ -51,12 +51,12 @@ extern "C" /* Allocate SIZE bytes of memory. */ -extern void *malloc (size_t size); +extern void *malloc (size_t size) ATTRIBUTE_MALLOC_SIZE ((1)); /* Re-allocate the previously allocated block in ptr, making the new block SIZE bytes long. */ -extern void *realloc (void *ptr, size_t size); +extern void *realloc (void *ptr, size_t size) ATTRIBUTE_ALLOC_SIZE ((2)); /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ -extern void *calloc (size_t nmemb, size_t size); +extern void *calloc (size_t nmemb, size_t size) ATTRIBUTE_MALLOC_SIZE ((1,2)); /* Free a block allocated by `malloc', `realloc' or `calloc'. */ extern void free (void *ptr); |