summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-08-07 19:42:08 +0200
committerBruno Haible <bruno@clisp.org>2021-08-07 19:42:08 +0200
commit5adafd694ccdddbc6ac476b126d7e7bf0ac7befa (patch)
tree5749f13cab0e5e7968d6c8462ff5aa15ba97ae0d /lib
parent8af7649e2aa594432c53f26cc7dafc0f8d2c13b3 (diff)
downloadgnulib-5adafd694ccdddbc6ac476b126d7e7bf0ac7befa.tar.gz
hamt: Improve GCC 11 allocation-deallocation checking.
* lib/hamt.h (hamt_free): Move declaration up. (hamt_create, hamt_copy): Declare that deallocation must happen through 'hamt_free'.
Diffstat (limited to 'lib')
-rw-r--r--lib/hamt.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/hamt.h b/lib/hamt.h
index 6bbc6a3f42..5d553fc7d1 100644
--- a/lib/hamt.h
+++ b/lib/hamt.h
@@ -138,20 +138,22 @@ typedef void (Hamt_freer) (Hamt_entry *elt);
/* Creation and Destruction */
/****************************/
+/* Free the resources solely allocated by HAMT and all elements solely
+ contained in it. */
+extern void hamt_free (Hamt *hamt);
+
/* Create and return a new and empty hash array mapped trie. */
_GL_ATTRIBUTE_NODISCARD
extern Hamt *hamt_create (Hamt_hasher *hasher, Hamt_comparator *comparator,
- Hamt_freer *freer);
+ Hamt_freer *freer)
+ _GL_ATTRIBUTE_DEALLOC (hamt_free, 1);
/* Return a copy of HAMT, which is not the same in the sense above.
This procedure can be used, for example, so that two threads can
access the same data independently. */
_GL_ATTRIBUTE_NODISCARD
-extern Hamt *hamt_copy (Hamt *hamt);
-
-/* Free the resources solely allocated by HAMT and all elements solely
- contained in it. */
-extern void hamt_free (Hamt *hamt);
+extern Hamt *hamt_copy (Hamt *hamt)
+ _GL_ATTRIBUTE_DEALLOC (hamt_free, 1);
/**********/
/* Lookup */