From b346e948cb167c18efc33f32f0e7cfb21050fc96 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 24 Jan 2016 16:58:59 -0500 Subject: objects partially implemented, fixes some bugs --- src/hash.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/hash.c') diff --git a/src/hash.c b/src/hash.c index a45ab54..a34e530 100644 --- a/src/hash.c +++ b/src/hash.c @@ -60,6 +60,8 @@ void *hash_init(size_t sz, unsigned (*hash_fn)(const void*), int (*compare_keys)(const void*, const void*)) { struct hash_map *ret = calloc(sizeof(struct hash_map), 1); + if(!sz) + sz = 1; ret->table = calloc(sz, sizeof(struct hash_node*)); ret->table_sz = sz; ret->hash = hash_fn; -- cgit v1.1