From 5ba3fb01bff56fc52d811118f5262889c479bd7b Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 2 Jun 2002 18:58:38 +0000 Subject: [PATCH] Fix 2 major bugs: -b switch caused crash, and all actions got corrupted. svn path=/trunk/yasm/; revision=646 --- tools/re2c/code.c | 5 +++-- tools/re2c/token.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/re2c/code.c b/tools/re2c/code.c index 9460e25a..3a45010b 100644 --- a/tools/re2c/code.c +++ b/tools/re2c/code.c @@ -100,7 +100,7 @@ static BitMap *BitMap_first = NULL; BitMap * BitMap_new(Go *g, State *x) { - BitMap *b; + BitMap *b = malloc(sizeof(BitMap)); b->go = g; b->on = x; b->next = BitMap_first; @@ -137,7 +137,8 @@ void BitMap_gen(FILE *o, uint lb, uint ub){ memset(bm, 0, n); fputs("\tstatic unsigned char yybm[] = {", o); for(i = 0; b; i += n){ - uchar m, j; + uchar m; + uint j; for(m = 0x80; b && m; b = b->next, m >>= 1){ b->i = i; b->m = m; doGen(b->go, b->on, bm-lb, m); diff --git a/tools/re2c/token.h b/tools/re2c/token.h index 9c1e5157..1acf4f44 100644 --- a/tools/re2c/token.h +++ b/tools/re2c/token.h @@ -22,7 +22,7 @@ static inline Token * Token_new(SubStr t, uint l) { Token *r = malloc(sizeof(Token)); - Str_copy(&r->text, &t); + Str_init(&r->text, &t); r->line = l; return r; }