commit 7ab5856146a046a2f8a2fedd19375a23be1690f2
parent c41400e10b2d33c1b1e5d1900add4cd17b34c7f0
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 8 Jul 2014 14:32:10 +0200
Remove gotos in newfield
These gotos were used only for saving some bytes in error handling.
This version removes this optimization and makes the code cleaner.
Diffstat:
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/cc1/decl.c b/cc1/decl.c
@@ -260,15 +260,15 @@ newfield(Type *tp, Symbol *sym)
{
register Field *p, *q;
register char *s, *t;
- static char *err;
s = sym->name;
for (q = p = tp->u.fields; p; q = p, p = p->next) {
t = p->name;
if (*s == *t && !strcmp(s, t))
- goto duplicated_name;
+ error("duplicated fields '%s' and '%s'", s, t);
if (sym->u.i == p->id)
- goto duplicated_value;
+ error("duplicated enumeration fields '%s' and '%s'",
+ s, t);
}
p = xmalloc(sizeof(*p));
@@ -282,14 +282,6 @@ newfield(Type *tp, Symbol *sym)
q->next = p;
return;
-
-duplicated_name:
- err = "duplicated fields '%s' and '%s'";
- goto error;
-duplicated_value:
- err = "duplicated enumeration fields '%s' and '%s'";
-error:
- error(err, s, t);
}
static void