[PATCH] Introduce xmalloc, memory allocator with die_out_of_memory()

Dmitry V. Levin ldv at altlinux.org
Fri Mar 20 14:27:26 UTC 2015


On Fri, Mar 20, 2015 at 02:53:39PM +0900, Masatake YAMATO wrote:
> --- a/defs.h
> +++ b/defs.h
> @@ -398,6 +398,13 @@ void error_msg_and_die(const char *fmt, ...) __attribute__ ((noreturn, format(pr
>  void perror_msg_and_die(const char *fmt, ...) __attribute__ ((noreturn, format(printf, 1, 2)));
>  void die_out_of_memory(void) __attribute__ ((noreturn));
>  
> +/*
> + * Memory allocator + die_out_of_memory
> + */
> +void *xmalloc(size_t size);
> +void *xcalloc(size_t nmmeb, size_t size);

Shouldn't __attribute_alloc_size__ and __attribute_malloc__ be added
to these functions?

> +void *xrealloc(void *ptr, size_t size);

Shouldn't __attribute_alloc_size__ be added to this function?


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150320/3a970582/attachment.bin>


More information about the Strace-devel mailing list