aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/types.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-13 20:53:39 +0200
committerlemon <lsof@mailbox.org>2022-08-13 20:53:39 +0200
commitddcca62a276c528a4390c8e3d58403b865f81869 (patch)
tree3d563e173a18095501f61f3b30e39cf62b4ff521 /bootstrap/types.c
parenta4ddca68662f4bc0531763357b4bc00b6c50b456 (diff)
ok..
Diffstat (limited to 'bootstrap/types.c')
-rw-r--r--bootstrap/types.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bootstrap/types.c b/bootstrap/types.c
index 37977ea..289f69f 100644
--- a/bootstrap/types.c
+++ b/bootstrap/types.c
@@ -10,6 +10,7 @@ static struct {
} **buckets;
char *tags;
} types;
+static vec_t(const struct type *) typesvec;
void
inittypes() {
@@ -163,6 +164,7 @@ interntype(struct type ty) {
ty._id = id++;
ty2 = typesput(&ty);
assert(ty2);
+ vec_push(&typesvec, ty2);
return ty2;
}
@@ -267,9 +269,9 @@ putprimtypes(struct env *env) {
void
visittypes(void (*visitor)(const struct type *, void *), void *arg) {
- for (int i = 0; i < types.nbuckets; ++i)
- for (struct typesnode *n = types.buckets[i]; n; n = n->next)
- visitor(&n->ty, arg);
+ int i; const struct type *ty;
+ vec_foreach(&typesvec, ty, i)
+ visitor(ty, arg);
}
const struct type *