From: Yu Watanabe Date: Sat, 12 Apr 2025 18:17:38 +0000 (+0900) Subject: hashmap: introduce ordered_hashmap_free_and_replace() X-Git-Tag: v258-rc1~789^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=09ddaf2af30a522cd8c585366a832d825aabac6e;p=thirdparty%2Fsystemd.git hashmap: introduce ordered_hashmap_free_and_replace() --- 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) {