shithub: scc

Download patch

ref: 9b4d794ae6c685b822c9318d2f343ca5e5814ffc
parent: e74b4c840eed17236373664d1fcf773a434e5f6b
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Jul 10 11:01:01 EDT 2014

Small changes in symbol.c

Revert change to lookup to improve readibility.

--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -73,9 +73,11 @@
 Symbol *
 lookup(register char *s, uint8_t ns)
 {
+	struct symtab *tbl;
 	register Symbol *sym;
 
-	for (sym = symtab[ns].htab[hash(s)]; sym; sym = sym->hash) {
+	tbl = &symtab[ns];
+	for (sym = tbl->htab[hash(s)]; sym; sym = sym->hash) {
 		if (!strcmp(sym->name, s))
 			return sym;
 	}
@@ -99,10 +101,7 @@
 	sym->next = tbl->head;
 	tbl->head = sym;
 
-
 	t = &tbl->htab[hash(s)];
 	sym->hash = *t;
-	*t = sym;
-
-	return sym;
+	return *t = sym;
 }
--