ref: b65a8b5e2010123b7af1ae1e2e67ea1b0dc6c35f
parent: 99fe6d525d3df915d9561abbdd75aadd12aacd12
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Oct 28 16:35:44 EDT 2013
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.
--- a/decl.c
+++ b/decl.c
@@ -306,7 +306,6 @@
addstmt(&c, np);
} while (accept(','));
- delctype(base);
expect(';');
return c.tree;
}
@@ -315,6 +314,7 @@
decl(void)
{
register struct ctype *base;
+ struct node *np;
repeat: if (!(base = specifier())) {
if (curctx != CTX_OUTER || yytoken != IDEN)
@@ -343,7 +343,9 @@
delctype(base);
goto repeat;
}
- return listdcl(base);
+ np = listdcl(base);
+ delctype(base);
+ return np;
}
void