commit ed927690e4c089521410d92c9d3b06dbc33b95bd
parent f73cc2f511c03315a6a4dfe6b8450b57b4fd1b49
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 8 Mar 2014 07:48:17 +0100
Initialize type pointer in struct symbols
Before this patch we were assign a new allocated type to the symbol,
and this new type had forward field to 0. The correct is not allocate a
new type and assign the input parameter as type of the symbol.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/decl.c b/decl.c
@@ -66,12 +66,13 @@ directdcl(register struct ctype *tp, unsigned char ns)
}
/* TODO: Add the type to the symbol */
+
static struct symbol *
aggregate(register struct ctype *tp)
{
struct symbol *sym = NULL;
- tp->forward = 1;
+ tp->forward = 1;
if (yytoken == IDEN) {
register struct ctype *aux;
@@ -83,7 +84,7 @@ aggregate(register struct ctype *tp)
}
*tp = *aux;
} else {
- sym->ctype = xmalloc(sizeof(*tp));
+ sym->ctype = tp;
tp->sym = sym;
tp->ns = ++nr_tags; /* FIX: It is only necessary */
} /* in struct and union */