diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-07-15 16:44:07 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-15 23:01:28 -0400 |
commit | 6c5c11cb1da94d139c60c9df95af35c2563c6243 (patch) | |
tree | ba2cf5f5e243a6b71d176f6a126c558997717b80 /lisc/parse.c | |
parent | 22c69707ce058aa3b558acd61ac7679004ad9612 (diff) | |
download | roux-6c5c11cb1da94d139c60c9df95af35c2563c6243.tar.gz |
simplify block handling
Diffstat (limited to 'lisc/parse.c')
-rw-r--r-- | lisc/parse.c | 23 |
1 files 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; i<NBlk; i++) - if (!bmap[i].blk || strcmp(bmap[i].name, name) == 0) + if (!bmap[i] || strcmp(bmap[i]->name, 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<NBlk; i++) { - bmap[i].name[0] = 0; - bmap[i].blk = 0; - } + for (i=0; i<NBlk; i++) + bmap[i] = 0; for (i=Tmp0; i<NSym; i++) sym[i] = (Sym){.type = SUndef}; ntmp = Tmp0; |