summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-11-01 20:26:32 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-11-01 20:26:32 -0700
commitfcd748480a76b3fef7586483b29fc5281e405e1f (patch)
treee4c6242ea005796849694656429c96e7d45f8552 /hash.c
parentbc4e96982da873a92f218010470ba65b1ef2a6e3 (diff)
downloadtxr-fcd748480a76b3fef7586483b29fc5281e405e1f.tar.gz
txr-fcd748480a76b3fef7586483b29fc5281e405e1f.tar.bz2
txr-fcd748480a76b3fef7586483b29fc5281e405e1f.zip
hash: expose new iterator interface.
* hash.c (struct hash): Declaration removed from here. (hash_iter_init, us_hash_iter_init, hash_iter_next, hash_iter_peek): Functions switched to external linkage. * hash.h (struct hash): Declared here now. (hash_iter_init, us_hash_iter_init, hash_iter_next, hash_iter_peek): Declared.
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/hash.c b/hash.c
index bc3bcbde..03c03436 100644
--- a/hash.c
+++ b/hash.c
@@ -84,13 +84,6 @@ struct hash {
struct hash_ops *hops;
};
-struct hash_iter {
- struct hash_iter *next;
- val hash;
- cnum chain;
- val cons;
-};
-
#define hash_seed (deref(lookup_var_l(nil, hash_seed_s)))
static_forward(struct hash_ops hash_eq_ops);
@@ -1052,7 +1045,7 @@ static struct cobj_ops hash_iter_ops = cobj_ops_init(eq,
hash_iter_mark,
cobj_eq_hash_op);
-static void hash_iter_init(struct hash_iter *hi, val hash, val self)
+void hash_iter_init(struct hash_iter *hi, val hash, val self)
{
struct hash *h = coerce(struct hash *, cobj_handle(self, hash, hash_s));
hi->next = 0;
@@ -1062,7 +1055,7 @@ static void hash_iter_init(struct hash_iter *hi, val hash, val self)
h->usecount++;
}
-static void us_hash_iter_init(struct hash_iter *hi, val hash)
+void us_hash_iter_init(struct hash_iter *hi, val hash)
{
struct hash *h = coerce(struct hash *, hash->co.handle);
hi->next = 0;
@@ -1092,12 +1085,12 @@ static val hash_iter_next_impl(struct hash_iter *hi, val iter)
return us_car(hi->cons);
}
-static val hash_iter_next(struct hash_iter *hi)
+val hash_iter_next(struct hash_iter *hi)
{
return hash_iter_next_impl(hi, 0);
}
-static val hash_iter_peek(struct hash_iter *hi)
+val hash_iter_peek(struct hash_iter *hi)
{
val hash = hi->hash;
struct hash *h = hash ? coerce(struct hash *, hash->co.handle) : 0;