aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/cc/cc.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-05-29 14:40:50 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-05-29 14:40:50 -0700
commit680d60678b273f1ff20b013b24954773f76b4e1d (patch)
treee164dd28a8534fe27313d604435333e897a45d39 /sys/cmd/cc/cc.c
parent3eff49e57b9d122a1da1103988731c9ace69c304 (diff)
checkin: before fix of stale type pointer bug
Diffstat (limited to 'sys/cmd/cc/cc.c')
-rw-r--r--sys/cmd/cc/cc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/cmd/cc/cc.c b/sys/cmd/cc/cc.c
index d5cd995..a25fd69 100644
--- a/sys/cmd/cc/cc.c
+++ b/sys/cmd/cc/cc.c
@@ -94,6 +94,19 @@ END:
// -----------------------------------------------------------------------
// type interning
+Type *
+type()
+{
+ Type *t;
+
+ if (C.type.len >= C.type.cap) {
+ C.type.cap += 100;
+ C.type.info = realloc(C.type.info, C.type.cap * sizeof(*C.type.info));
+ }
+
+ return C.type.info + C.type.len++;
+}
+
// -----------------------------------------------------------------------
// universal compiler builtins