scc

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

commit eb12bd70592fe92197ceec3bbfd8d064ad273a33
parent 49a6da6aba2474bc86f8b5335b45f8959c078b18
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed,  9 Jul 2014 11:59:24 +0200

Remove premature optimization

We don't know until what point the lookup optimization is good,
so wait until measarument.

Diffstat:
Mcc1/symbol.c | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -71,13 +71,10 @@ context(Symbol *lbreak, Symbol *lcont, Caselist *lswitch) Symbol * lookup(register char *s, uint8_t ns) { - static struct symtab *tbl; register Symbol *sym; - tbl = &symtab[ns]; - for (sym = tbl->htab[hash(s)]; sym; sym = sym->hash) { - register char *t = sym->name; - if (*t == *s && !strcmp(t, s)) + for (sym = symtab[ns].htab[hash(s)]; sym; sym = sym->hash) { + if (!strcmp(sym->name, s)) return sym; }