scc

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

commit f60d000d6fbecc3541928fe1112bed3d0dbaeef5
parent f1adcb5a9b3ed145e0e42248aa11578ecb7ef2ee
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
Date:   Fri, 15 Apr 2016 01:19:48 +0200

[cc2] Use NNODESinstead of NSYMBOLS

This is an error due to the first arena implementation was done in symbol.c.

Diffstat:
Mcc2/node.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cc2/node.c b/cc2/node.c @@ -7,7 +7,7 @@ #include "arch.h" #include "cc2.h" -#define NSYMBOLS 32 +#define NNODES 32 Symbol *curfun; @@ -28,10 +28,10 @@ newnode(void) if (!freep) { ap = xmalloc(sizeof(*ap)); - ap->mem = xcalloc(NSYMBOLS, sizeof(Node)); + ap->mem = xcalloc(NNODES, sizeof(Node)); ap->next = arena; arena = ap; - for (np = ap->mem; np < &ap->mem[NSYMBOLS-1]; ++np) + for (np = ap->mem; np < &ap->mem[NNODES-1]; ++np) np->left = np+1; np->left = NULL; freep = np;