ref: dc338852ab7da15657147df7df25eec078e09aa1
parent: 767e744e5841c7bfe108b0787d96e109c897aff2
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jun 24 10:33:06 EDT 2017
Clean up source marking a bit.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -120,14 +120,11 @@
static void marksrc(Inferstate *st, Type *t, Srcloc l)
{
- size_t sz;
-
- sz = max(t->tid + 1, st->nusrc);
- if (sz > st->nusrc) {
- st->usrc = zrealloc(st->usrc, st->nusrc*sizeof(Srcloc), sz*sizeof(Srcloc));
- st->nusrc = sz;
- }
t = tf(st, t);
+ if (t->tid >= st->nusrc) {
+ st->usrc = zrealloc(st->usrc, st->nusrc*sizeof(Srcloc), (t->tid + 1)*sizeof(Srcloc));
+ st->nusrc = t->tid + 1;
+ }
if (st->usrc[t->tid].line <= 0)
st->usrc[t->tid] = l;
}