tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit b7bb03cb98be281977d54c41514026657414a183
parent 7fb86eeaa1d74a202984e08b93b516a8daf6d77a
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Tue, 21 Aug 2018 15:50:43 -0700

Remove unnecessary zeroing

Diffstat:
tisp.c | 5-----
1 file changed, 0 insertions(+), 5 deletions(-)

diff --git a/tisp.c b/tisp.c @@ -129,14 +129,11 @@ hash(char *key) static Hash hash_new(size_t cap) { - int i; if (cap < 1) return NULL; Hash ht = emalloc(sizeof(struct Hash)); ht->size = 0; ht->cap = cap; ht->items = ecalloc(cap, sizeof(struct Entry)); - for (i = 0; i < cap; i++) - ht->items[i].key = NULL; ht->next = NULL; return ht; } @@ -179,8 +176,6 @@ hash_grow(Hash ht) Entry oitems = ht->items; ht->cap *= 2; ht->items = ecalloc(ht->cap, sizeof(struct Entry)); - for (i = 0; i < ht->cap; i++) /* empty the new larger hash table */ - ht->items[i].key = NULL; for (i = 0; i < ocap; i++) /* repopulate new hash table with old values */ if (oitems[i].key) hash_add(ht, oitems[i].key, oitems[i].val);