[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hamt: Improve GCC 11 allocation-deallocation checking
From: |
Bruno Haible |
Subject: |
hamt: Improve GCC 11 allocation-deallocation checking |
Date: |
Sat, 07 Aug 2021 19:43:34 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; ) |
2021-08-07 Bruno Haible <bruno@clisp.org>
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'.
diff --git a/lib/hamt.h b/lib/hamt.h
index 6bbc6a3..5d553fc 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 */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- hamt: Improve GCC 11 allocation-deallocation checking,
Bruno Haible <=