* c-xvasprintf: Improve GCC 11 allocation-deallocation checking
@ 2021-08-07 17:18 Bruno Haible
0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2021-08-07 17:18 UTC (permalink / raw)
To: bug-gnulib
2021-08-07 Bruno Haible <bruno@clisp.org>
c-xvasprintf: Improve GCC 11 allocation-deallocation checking.
* lib/c-xvasprintf.h: Include <stdlib.h>.
(c_xasprintf, c_xvasprintf): Declare that deallocation must happen
through 'free'.
diff --git a/lib/c-xvasprintf.h b/lib/c-xvasprintf.h
index ae48780..69e5c1b 100644
--- a/lib/c-xvasprintf.h
+++ b/lib/c-xvasprintf.h
@@ -23,6 +23,8 @@
/* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD. */
#include <stdio.h>
+#include <stdlib.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -38,9 +40,11 @@ extern "C" {
Formatting takes place in the C locale, that is, the decimal point
used in floating-point formatting directives is always '.'. */
extern char *c_xasprintf (const char *format, ...)
- _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2));
+ _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2))
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL;
extern char *c_xvasprintf (const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 0));
+ _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 0))
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL;
#ifdef __cplusplus
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-07 17:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-07 17:18 c-xvasprintf: Improve GCC 11 allocation-deallocation checking Bruno Haible
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).