scc

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

commit b65a8b5e2010123b7af1ae1e2e67ea1b0dc6c35f
parent 99fe6d525d3df915d9561abbdd75aadd12aacd12
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 28 Oct 2013 20:35:44 +0100

Move delctype to decl

Deleting objects in the same function where they are created
is a good style, because you can always see the full cycle of
lyfe of an object, because if you delete them in other
function is harder seeing it.

Diffstat:
Mdecl.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/decl.c b/decl.c @@ -306,7 +306,6 @@ listdcl(struct ctype *base) addstmt(&c, np); } while (accept(',')); - delctype(base); expect(';'); return c.tree; } @@ -315,6 +314,7 @@ struct node * decl(void) { register struct ctype *base; + struct node *np; repeat: if (!(base = specifier())) { if (curctx != CTX_OUTER || yytoken != IDEN) @@ -343,7 +343,9 @@ repeat: if (!(base = specifier())) { delctype(base); goto repeat; } - return listdcl(base); + np = listdcl(base); + delctype(base); + return np; } void