diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2009-12-08 13:48:19 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2009-12-08 13:48:19 -0800 |
commit | 08ee01ea9e6bd1bedd565f9e0e1c1a8938710887 (patch) | |
tree | 9d7c5017323261a681b8458b2dbd7ffe105e56fd /hash.c | |
parent | 0c86abee82a66963ec3c46e36c63ba8df89e1fa9 (diff) | |
download | txr-08ee01ea9e6bd1bedd565f9e0e1c1a8938710887.tar.gz txr-08ee01ea9e6bd1bedd565f9e0e1c1a8938710887.tar.bz2 txr-08ee01ea9e6bd1bedd565f9e0e1c1a8938710887.zip |
All COBJ operations have default implementations now;
no null pointer check over struct cobj_ops operations.
New typechecking function for COBJ objects.
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -115,22 +115,20 @@ static cnum ll_hash(val obj) lazy_str_force(obj); return ll_hash(obj->ls.prefix); case COBJ: - if (obj->co.ops->hash) - return obj->co.ops->hash(obj); - return ((cnum) obj) & NUM_MAX; + return obj->co.ops->hash(obj); } internal_error("unhandled case in equal function"); } -val hash_obj(val obj) +cnum cobj_hash_op(val obj) { - return num(ll_hash(obj)); + return ((cnum) obj) & NUM_MAX; } -static val hash_equal(val self, val other) +val hash_obj(val obj) { - return self == other ? t : nil; + return num(ll_hash(obj)); } static void hash_destroy(val hash) @@ -187,11 +185,11 @@ static void hash_mark(val hash) } static struct cobj_ops hash_ops = { - hash_equal, + cobj_equal_op, cobj_print_op, hash_destroy, hash_mark, - 0 + cobj_hash_op }; static void hash_grow(struct hash *h) |