scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 0dc8403f3a7a439033d22d7f181d4798f9f1dc7a
parent a07bd3876a100283fe8cb101760ab6843b2869ae
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 29 Oct 2013 07:41:22 +0100

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.

Diffstat:
Mdecl.c | 2+-
Msymbol.c | 4+---
Msymbol.h | 3+--
3 files changed, 3 insertions(+), 6 deletions(-)

diff --git 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); diff --git a/symbol.c b/symbol.c @@ -79,9 +79,7 @@ lookup(register const char *s, signed char ns) 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; } diff --git 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 {