+2021-08-07 Bruno Haible <bruno@clisp.org>
+
+ uninorm, unistr: Improve GCC 11 allocation-deallocation checking.
+ * lib/uninorm.in.h (uninorm_filter_free): Move declaration up.
+ (uninorm_filter_create): Declare that deallocation must happen through
+ 'uninorm_filter_free'.
+ * lib/unistr.in.h: Include <stdlib.h>.
+ (u8_strdup, u16_strdup, u32_strdup): Declare that deallocation must
+ happen through 'free'.
+
2021-08-07 Bruno Haible <bruno@clisp.org>
ialloc: Prepare for allocation-deallocation checking.
sequence to the encapsulated stream of Unicode characters. */
struct uninorm_filter;
+/* Bring data buffered in the filter to its destination, the encapsulated
+ stream, then close and free the filter.
+ Return 0 if successful, or -1 with errno set upon failure. */
+extern int
+ uninorm_filter_free (struct uninorm_filter *filter);
+
/* Create and return a normalization filter for Unicode characters.
The pair (stream_func, stream_data) is the encapsulated stream.
stream_func (stream_data, uc) receives the Unicode character uc
extern struct uninorm_filter *
uninorm_filter_create (uninorm_t nf,
int (*stream_func) (void *stream_data, ucs4_t uc),
- void *stream_data);
+ void *stream_data)
+ _GL_ATTRIBUTE_DEALLOC (uninorm_filter_free, 1);
/* Stuff a Unicode character into a normalizing filter.
Return 0 if successful, or -1 with errno set upon failure. */
extern int
uninorm_filter_flush (struct uninorm_filter *filter);
-/* Bring data buffered in the filter to its destination, the encapsulated
- stream, then close and free the filter.
- Return 0 if successful, or -1 with errno set upon failure. */
-extern int
- uninorm_filter_free (struct uninorm_filter *filter);
-
#ifdef __cplusplus
}
/* Get size_t, ptrdiff_t. */
#include <stddef.h>
+/* Get free(). */
+#include <stdlib.h>
+
#ifdef __cplusplus
extern "C" {
#endif
/* Duplicate S, returning an identical malloc'd string. */
/* Similar to strdup(), wcsdup(). */
extern uint8_t *
- u8_strdup (const uint8_t *s);
+ u8_strdup (const uint8_t *s)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
extern uint16_t *
- u16_strdup (const uint16_t *s);
+ u16_strdup (const uint16_t *s)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
extern uint32_t *
- u32_strdup (const uint32_t *s);
+ u32_strdup (const uint32_t *s)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
/* Find the first occurrence of UC in STR. */
/* Similar to strchr(), wcschr(). */