shithub: scc

Download patch

ref: eb12bd70592fe92197ceec3bbfd8d064ad273a33
parent: 49a6da6aba2474bc86f8b5335b45f8959c078b18
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Jul 9 07:59:24 EDT 2014

Remove premature optimization

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

--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -71,13 +71,10 @@
 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;
 	}