diff options
author | Karel Zak | 2011-02-07 17:29:47 +0100 |
---|---|---|
committer | Karel Zak | 2011-02-07 17:29:47 +0100 |
commit | 40084d0d5c5031580907d61e2df81b5b21af6c68 (patch) | |
tree | de96970d47e2bab2691361b596509b152c3f4450 /include/xalloc.h | |
parent | fsck: include c.h, fallback for PATH_MAX (diff) | |
download | kernel-qcow2-util-linux-40084d0d5c5031580907d61e2df81b5b21af6c68.tar.gz kernel-qcow2-util-linux-40084d0d5c5031580907d61e2df81b5b21af6c68.tar.xz kernel-qcow2-util-linux-40084d0d5c5031580907d61e2df81b5b21af6c68.zip |
include: [c.h] add fallback for alloc_size attributes
Reported-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include/xalloc.h')
-rw-r--r-- | include/xalloc.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/xalloc.h b/include/xalloc.h index fc2f886dd..27efa30c5 100644 --- a/include/xalloc.h +++ b/include/xalloc.h @@ -13,11 +13,13 @@ #include <stdlib.h> #include <err.h> +#include "c.h" + #ifndef XALLOC_EXIT_CODE # define XALLOC_EXIT_CODE EXIT_FAILURE #endif -static inline __attribute__((alloc_size(1))) +static inline __ul_alloc_size(1) void *xmalloc(const size_t size) { void *ret = malloc(size); @@ -27,7 +29,7 @@ void *xmalloc(const size_t size) return ret; } -static inline __attribute__((alloc_size(2))) +static inline __ul_alloc_size(2) void *xrealloc(void *ptr, const size_t size) { void *ret = realloc(ptr, size); @@ -37,7 +39,7 @@ void *xrealloc(void *ptr, const size_t size) return ret; } -static inline __attribute__((alloc_size(1,2))) +static inline __ul_calloc_size(1, 2) void *xcalloc(const size_t nelems, const size_t size) { void *ret = calloc(nelems, size); |