summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index 86ceb340..0b7c099d 100644
--- a/hash.c
+++ b/hash.c
@@ -223,11 +223,16 @@ obj_t *make_hash(obj_t *weak_keys, obj_t *weak_vals)
int flags = ((weak_vals != nil) << 1) | (weak_keys != nil);
struct hash *h = (struct hash *) chk_malloc(sizeof *h);
obj_t *mod = num(256);
+ obj_t *table = vector(mod);
+ obj_t *hash = cobj((void *) h, hash_t, &hash_ops);
+
+ vec_set_fill(table, mod);
+
h->flags = (hash_flags_t) flags;
h->modulus = c_num(mod);
- h->table = vector(mod);
- vec_set_fill(h->table, mod);
- return cobj((void *) h, hash_t, &hash_ops);
+ h->table = table;
+
+ return hash;
}
obj_t **gethash_l(obj_t *hash, obj_t *key)