[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
string-buffer: Improve GCC 11 allocation-deallocation checking
From: |
Bruno Haible |
Subject: |
string-buffer: Improve GCC 11 allocation-deallocation checking |
Date: |
Sat, 07 Aug 2021 22:18:27 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; ) |
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'.
diff --git a/lib/string-buffer.h b/lib/string-buffer.h
index 129dceb..2dae5da 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
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- string-buffer: Improve GCC 11 allocation-deallocation checking,
Bruno Haible <=