diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-15 15:58:31 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-15 15:58:31 -0600 |
commit | db9a58f48c6eae16fbfcd89d59b09e123dbed54f (patch) | |
tree | 8e20dd9bc3ddf7b766714a57a9d33259c0b91165 /libmisc/map.c | |
parent | 03f29736acfcfaee6f263fd1461f96ccae3696da (diff) |
libmisc: Add alloc.h to help detect wrong alloc sizes
Lo and behold, there was a mistake in chan.c.
Diffstat (limited to 'libmisc/map.c')
-rw-r--r-- | libmisc/map.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libmisc/map.c b/libmisc/map.c index 7629c8c..cc34c16 100644 --- a/libmisc/map.c +++ b/libmisc/map.c @@ -8,6 +8,7 @@ #include <string.h> #include <libmisc/hash.h> +#include <libmisc/alloc.h> #include <libmisc/assert.h> #include <libmisc/map.h> @@ -63,7 +64,7 @@ static inline void _map_lookup(struct _map *m, void *keyp, static inline void _map_resize(struct _map *m, size_t new_nbuckets) { assert(m); assert(new_nbuckets); - struct _map_kv_list *new_buckets = calloc(new_nbuckets, sizeof(struct _map_kv_list)); + struct _map_kv_list *new_buckets = heap_alloc(new_nbuckets, struct _map_kv_list); for (size_t i = 0; i < m->nbuckets; i++) { while (m->buckets[i].front) { struct _map_kv_list_node *kv = m->buckets[i].front; |