From 6c5c11cb1da94d139c60c9df95af35c2563c6243 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Wed, 15 Jul 2015 16:44:07 -0400 Subject: [PATCH] simplify block handling --- lisc/parse.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/lisc/parse.c b/lisc/parse.c index a3f9e23..3c00144 100644 --- a/lisc/parse.c +++ b/lisc/parse.c @@ -61,10 +61,7 @@ static Sym sym[NSym]; static int ntmp; static Ins ins[NIns], *curi; static Phi **plink; -static struct { - char name[NString]; - Blk *blk; -} bmap[NBlk+1]; +static Blk *bmap[NBlk+1]; static Blk *curb; static Blk **blink; static int nblk; @@ -253,17 +250,15 @@ findblk(char *name) assert(name[0]); for (i=0; iname, name) == 0) break; if (i == NBlk) err("too many blocks"); - if (!bmap[i].blk) { - assert(bmap[i].name[0] == 0); - strcpy(bmap[i].name, name); - bmap[i].blk = blocka(); - strcpy(bmap[i].blk->name, name); + if (!bmap[i]) { + bmap[i] = blocka(); + strcpy(bmap[i]->name, name); } - return bmap[i].blk; + return bmap[i]; } static void @@ -440,10 +435,8 @@ parsefn(FILE *f) Fn *fn; inf = f; - for (i=0; i