diff options
author | Bruno Haible <bruno@clisp.org> | 2021-08-08 02:14:11 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2021-08-08 02:14:11 +0200 |
commit | 526cd383bd18ea29e390548cfde68e2d6d7fa5f9 (patch) | |
tree | f70e16da939f8cab5f8448d636e80b64b6938ffd /lib/unistr.in.h | |
parent | 54c36a38b1b30055133d46a8fe2f69a73f8284c4 (diff) | |
download | gnulib-526cd383bd18ea29e390548cfde68e2d6d7fa5f9.tar.gz |
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'.
Diffstat (limited to 'lib/unistr.in.h')
-rw-r--r-- | lib/unistr.in.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/unistr.in.h b/lib/unistr.in.h index ed657773c4..3b38207f90 100644 --- a/lib/unistr.in.h +++ b/lib/unistr.in.h @@ -25,6 +25,9 @@ /* Get size_t, ptrdiff_t. */ #include <stddef.h> +/* Get free(). */ +#include <stdlib.h> + #ifdef __cplusplus extern "C" { #endif @@ -624,11 +627,14 @@ extern int /* 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(). */ |