From ddcca62a276c528a4390c8e3d58403b865f81869 Mon Sep 17 00:00:00 2001 From: lemon Date: Sat, 13 Aug 2022 20:53:39 +0200 Subject: ok.. --- bootstrap/types.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bootstrap/types.c') 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 * -- cgit v1.2.3