diff options
author | Bruno Haible <bruno@clisp.org> | 2021-08-07 23:08:45 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2021-08-07 23:08:45 +0200 |
commit | 5c2fcfe2817f9d148807fd00efc6214fe4aea0a5 (patch) | |
tree | 27a3ff02d2f10476da5a930e1d613f3838477af4 /lib/xmemdup0.h | |
parent | 4a0993e377f69cdf533d72f00d74471af870bb05 (diff) | |
download | gnulib-5c2fcfe2817f9d148807fd00efc6214fe4aea0a5.tar.gz |
xmemdup0: Improve GCC 11 allocation-deallocation checking.
* lib/xmemdup0.h: Include <stdlib.h> instead of <stddef.h>.
(xmemdup0): Declare that deallocation must happen through 'free'.
Diffstat (limited to 'lib/xmemdup0.h')
-rw-r--r-- | lib/xmemdup0.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/xmemdup0.h b/lib/xmemdup0.h index 4f3b581488..6e34348336 100644 --- a/lib/xmemdup0.h +++ b/lib/xmemdup0.h @@ -18,14 +18,16 @@ #ifndef XMEMDUP_H_ # define XMEMDUP_H_ -# include <stddef.h> +# include <stdlib.h> # ifdef __cplusplus extern "C" { # endif -char *xmemdup0 (void const *p, size_t s); +char *xmemdup0 (void const *p, size_t s) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_RETURNS_NONNULL; # ifdef __cplusplus } |