striconv: Improve GCC 11 allocation-deallocation checking.
authorBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 20:08:16 +0000 (22:08 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 20:08:16 +0000 (22:08 +0200)
* lib/striconv.h: Include <stdlib.h> instead of <stddef.h>.
(str_cd_iconv, str_iconv): Declare that deallocation must happen through
'free'.

ChangeLog
lib/striconv.h

index 89e3f5551d8ba95404b80ca4784c7ed2f3ad9361..3d25b0301852682c4a942c8e6babb3e433c3e721 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-08-07  Bruno Haible  <bruno@clisp.org>
+
+       striconv: Improve GCC 11 allocation-deallocation checking.
+       * lib/striconv.h: Include <stdlib.h> instead of <stddef.h>.
+       (str_cd_iconv, str_iconv): Declare that deallocation must happen through
+       'free'.
+
 2021-08-07  Bruno Haible  <bruno@clisp.org>
 
        relocatable-lib-lgpl: Improve GCC 11 allocation-deallocation checking.
index 69da35d2d893eb38b3459c8831f8af1fc08cd1e5..c192ee165d99a254f20e00bd9544e6d78b2567b1 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef _STRICONV_H
 #define _STRICONV_H
 
-#include <stddef.h>
+#include <stdlib.h>
 #if HAVE_ICONV
 #include <iconv.h>
 #endif
@@ -52,7 +52,8 @@ extern int mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
    Allocate a malloced memory block for the result.
    Return value: the freshly allocated resulting NUL-terminated string if
    successful, otherwise NULL and errno set.  */
-extern char * str_cd_iconv (const char *src, iconv_t cd);
+extern char * str_cd_iconv (const char *src, iconv_t cd)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
 
 #endif
 
@@ -64,7 +65,8 @@ extern char * str_cd_iconv (const char *src, iconv_t cd);
    Return value: the freshly allocated resulting NUL-terminated string if
    successful, otherwise NULL and errno set.  */
 extern char * str_iconv (const char *src,
-                         const char *from_codeset, const char *to_codeset);
+                         const char *from_codeset, const char *to_codeset)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
 
 
 #ifdef __cplusplus