summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-08-07 22:16:55 +0200
committerBruno Haible <bruno@clisp.org>2021-08-07 22:16:55 +0200
commit40cc7b7ee4e261ea3476717e0e8565fe11464fba (patch)
treece536ce5ff8c8ef088ec319e0e7382951399bdb2
parent21884ba6ddab17cc9dd05c92b6b31943f3173db8 (diff)
downloadgnulib-40cc7b7ee4e261ea3476717e0e8565fe11464fba.tar.gz
string-buffer: Improve GCC 11 allocation-deallocation checking.
* lib/string-buffer.h: Include <stdlib.h> instead of <stddef.h>. (sb_dupfree): Declare that deallocation must happen through 'free'.
-rw-r--r--ChangeLog6
-rw-r--r--lib/string-buffer.h5
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index aed8b7bd0a..b87440ed06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2021-08-07 Bruno Haible <bruno@clisp.org>
+ string-buffer: Improve GCC 11 allocation-deallocation checking.
+ * lib/string-buffer.h: Include <stdlib.h> instead of <stddef.h>.
+ (sb_dupfree): Declare that deallocation must happen through 'free'.
+
+2021-08-07 Bruno Haible <bruno@clisp.org>
+
striconveha: Improve GCC 11 allocation-deallocation checking.
* lib/striconveha.h: Include <stdlib.h> instead of <stddef.h>.
(str_iconveha): Declare that deallocation must happen through 'free'.
diff --git a/lib/string-buffer.h b/lib/string-buffer.h
index 129dcebe6e..2dae5da889 100644
--- a/lib/string-buffer.h
+++ b/lib/string-buffer.h
@@ -21,7 +21,7 @@
#include <stdarg.h>
#include <stdbool.h>
-#include <stddef.h>
+#include <stdlib.h>
#include "attribute.h"
@@ -76,7 +76,8 @@ extern void sb_free (struct string_buffer *buffer);
/* Returns the contents of BUFFER, and frees all other memory held
by BUFFER. Returns NULL upon failure or if there was an error earlier.
It is the responsibility of the caller to free() the result. */
-extern char * sb_dupfree (struct string_buffer *buffer);
+extern char * sb_dupfree (struct string_buffer *buffer)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
#ifdef __cplusplus
}