scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 6a25f2333af960b52d8a52aab9cb817b2f22dc5a
parent 86ecad940ba36eef7bbe3c76cc2d76a7f012763a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 29 Jun 2012 21:59:32 +0200

Fixed bug declaring and initializating ctype struct

it can't be a static variable because it will be used in a recursive way. In
other hand the memset call was incorrect to.

Diffstat:
Mdecl.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/decl.c b/decl.c @@ -145,10 +145,11 @@ static void listdcl(register struct ctype *cp) unsigned char decl(void) { - static struct ctype ctype; + auto struct ctype ctype; if (accept(';')) return 1; + memset(&ctype, 0, sizeof(ctype)); if (!spec(&ctype)) { if (nested_level != 0) return 0;