]> Savannah Git Hosting - gnulib.git/commitdiff
xmemdup0: Improve GCC 11 allocation-deallocation checking.
authorBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 21:08:45 +0000 (23:08 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 21:08:45 +0000 (23:08 +0200)
* lib/xmemdup0.h: Include <stdlib.h> instead of <stddef.h>.
(xmemdup0): Declare that deallocation must happen through 'free'.

ChangeLog
lib/xmemdup0.h

index 2a8bcf90e45ef0123d0eb77e5426f7c3821ef74b..336da1deb67b6e43646ca6a96f8ac628dea1c125 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-08-07  Bruno Haible  <bruno@clisp.org>
+
+       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'.
+
 2021-08-07  Bruno Haible  <bruno@clisp.org>
 
        windows-spawn: Improve GCC 11 allocation-deallocation checking.
index 4f3b5814881ac4e8bac8da9b976b58ae3c83e1e5..6e34348336cbaff373ea59b598a6f958523633c6 100644 (file)
 #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
 }