From 09ddaf2af30a522cd8c585366a832d825aabac6e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 13 Apr 2025 03:17:38 +0900 Subject: [PATCH] hashmap: introduce ordered_hashmap_free_and_replace() --- src/basic/hashmap.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/basic/hashmap.h b/src/basic/hashmap.h index 091062b5e91..c577bd6c22a 100644 --- a/src/basic/hashmap.h +++ b/src/basic/hashmap.h @@ -88,8 +88,10 @@ OrderedHashmap* _ordered_hashmap_new(const struct hash_ops *hash_ops HASHMAP_DE #define hashmap_new(ops) _hashmap_new(ops HASHMAP_DEBUG_SRC_ARGS) #define ordered_hashmap_new(ops) _ordered_hashmap_new(ops HASHMAP_DEBUG_SRC_ARGS) -#define hashmap_free_and_replace(a, b) \ +#define hashmap_free_and_replace(a, b) \ free_and_replace_full(a, b, hashmap_free) +#define ordered_hashmap_free_and_replace(a, b) \ + free_and_replace_full(a, b, ordered_hashmap_free) HashmapBase* _hashmap_free(HashmapBase *h, free_func_t default_free_key, free_func_t default_free_value); static inline Hashmap* hashmap_free(Hashmap *h) { -- 2.47.3