src/hash_map.c

changeset 1618
ef7cab6eb131
parent 1587
7156d6699410
--- a/src/hash_map.c	Tue Dec 16 21:33:58 2025 +0100
+++ b/src/hash_map.c	Wed Dec 17 19:05:50 2025 +0100
@@ -414,8 +414,7 @@
         buckets = 16;
     }
 
-    struct cx_hash_map_s *map = cxCalloc(allocator, 1,
-                                         sizeof(struct cx_hash_map_s));
+    struct cx_hash_map_s *map = cxZalloc(allocator, sizeof(struct cx_hash_map_s));
     if (map == NULL) return NULL;
 
     // initialize hash map members
@@ -433,9 +432,12 @@
 
     if (itemsize > 0) {
         map->base.collection.elem_size = itemsize;
+        map->base.collection.advanced_cmp = cx_acmp_memcmp;
+        map->base.collection.cmp_data = &map->base.collection.elem_size;
     } else {
         map->base.collection.elem_size = sizeof(void *);
         map->base.collection.store_pointer = true;
+        map->base.collection.simple_cmp = cx_cmp_ptr;
     }
 
     return (CxMap *) map;

mercurial