ref: d65e66829ce3e79ffb92fd58675f5e655561a37a
parent: 12e0b049f96901be321d7797730555f81af2eee8
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Mar 11 12:27:00 EDT 2014
Optimize ctype function Unify all the error calls.
--- a/types.c
+++ b/types.c
@@ -107,6 +107,7 @@
ctype(struct ctype *tp, unsigned char tok)
{
register unsigned char type;
+ static char *err;
if (!tp->defined) {
tp->type = 0;
@@ -200,13 +201,17 @@
return tp;
both_sign:
- error("both 'signed' and 'unsigned' in declaration specifiers");
+ err = "both 'signed' and 'unsigned' in declaration specifiers";
+ goto error;
duplicated:
- error("duplicated '%s'", yytext);
+ err = "duplicated '%s'";
+ goto error;
invalid_sign:
- error("invalid sign modifier");
+ err = "invalid sign modifier";
+ goto error;
two_or_more:
- error("two or more basic types");
+ err = "two or more basic types";
+error: error(err, yytext);
}
struct qualifier *
--
⑨