hashmap: check if identical hash_ops is specified if already allocated

This commit is contained in:
Yu Watanabe
2025-05-08 05:58:33 +09:00
parent 472379925c
commit bc169c4fa2
3 changed files with 17 additions and 22 deletions
+3 -1
View File
@@ -824,8 +824,10 @@ static int hashmap_base_ensure_allocated(HashmapBase **h, const struct hash_ops
assert(h);
if (*h)
if (*h) {
assert((*h)->hash_ops == (hash_ops ?: &trivial_hash_ops));
return 0;
}
q = hashmap_base_new(hash_ops, type);
if (!q)