diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-02-14 17:46:20 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-02-14 17:46:20 -0800 |
commit | 5fcb0c9d430cf3ebb4c180ff38e805c6d18d5dea (patch) | |
tree | 29995544cd565ae5c267b71a52efec23cc3eed44 | |
parent | 6b4e2804f2da87aa3d15d407acc9b774a01d1555 (diff) | |
download | txr-5fcb0c9d430cf3ebb4c180ff38e805c6d18d5dea.tar.gz txr-5fcb0c9d430cf3ebb4c180ff38e805c6d18d5dea.tar.bz2 txr-5fcb0c9d430cf3ebb4c180ff38e805c6d18d5dea.zip |
* hash.c (inhash): Simplify with gethash_c.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | hash.c | 15 |
2 files changed, 9 insertions, 10 deletions
@@ -1,5 +1,9 @@ 2014-02-14 Kaz Kylheku <kaz@kylheku.com> + * hash.c (inhash): Simplify with gethash_c. + +2014-02-14 Kaz Kylheku <kaz@kylheku.com> + Replacing acons_new_l and aconsq_new_l interfaces with ones that return the new or old cons cell rather than a pointer to its cdr field. @@ -544,23 +544,18 @@ val gethash(val hash, val key) val inhash(val hash, val key, val init) { - val found; + val cell; if (missingp(init)) { - gethash_f(hash, key, &found); + gethash_f(hash, key, &cell); } else { - struct hash *h = (struct hash *) cobj_handle(hash, hash_s); - val *pchain = vecref_l(h->table, num_fast(h->hash_fun(key) % h->modulus)); - val old = *pchain, new_p; - val cell = h->acons_new_c_fun(key, &new_p, pchain); - if (old != *pchain && ++h->count > 2 * h->modulus) - hash_grow(h); + val new_p; + cell = gethash_c(hash, key, &new_p); if (new_p) rplacd(cell, init); - found = h->assoc_fun(key, *pchain); } - return found; + return cell; } val gethash_f(val hash, val key, val *found) |