shithub: scc

Download patch

ref: 0dc8403f3a7a439033d22d7f181d4798f9f1dc7a
parent: a07bd3876a100283fe8cb101760ab6843b2869ae
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Oct 29 03:41:22 EDT 2013

Remove NS_ANY namespace

This namespace was used in previous implementation of lookup when
looking for a symbol without knowing the namespace of this symbol,
but like we don't do this search anymore we can remove it.

--- a/decl.c
+++ b/decl.c
@@ -11,7 +11,7 @@
 char parser_out_home;
 
 static struct symbol *cursym;
-static unsigned char nr_structs = NS_ANY + 1;
+static unsigned char nr_structs = NS_STRUCT;
 static unsigned char structbuf[NR_STRUCT_LEVEL], *structp = &structbuf[0];
 
 static void declarator(struct ctype *tp, unsigned char ns);
--- a/symbol.c
+++ b/symbol.c
@@ -79,9 +79,7 @@
 	key = hash(s) & NR_SYM_HASH - 1;
 
 	for (sym = htab[key]; sym; sym = sym->hash) {
-		if (ns != NS_ANY && ns != sym->ns)
-			continue;
-		if (!memcmp(sym->name, s, l))
+		if (ns == sym->ns && !memcmp(sym->name, s, l))
 			return sym;
 	}
 
--- a/symbol.h
+++ b/symbol.h
@@ -13,10 +13,9 @@
 enum {
 	NS_IDEN,
 	NS_KEYWORD,
-	NS_STRUCT,
 	NS_LABEL,
 	NS_TYPEDEF,
-	NS_ANY
+	NS_STRUCT
 };
 
 struct ctype {