diff options
author | Michal Marek <mmarek@suse.cz> | 2011-02-15 15:11:36 +0100 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2011-03-17 15:13:55 +0100 |
commit | 01762c4ec5f6f62c550304b9c70e824293cefdd0 (patch) | |
tree | 4a457cec48321f5b591966e56ddaea33733df5cc /scripts/genksyms/genksyms.c | |
parent | 68eb8563a1adf27fae18dde4c95fb796c17563df (diff) | |
download | linux-01762c4ec5f6f62c550304b9c70e824293cefdd0.tar.bz2 |
genksyms: simplify usage of find_symbol()
Allow searching for symbols of an exact type. The lexer does this and a
subsequent patch will add one more usage.
Signed-off-by: Michal Marek <mmarek@suse.cz>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/genksyms/genksyms.c')
-rw-r--r-- | scripts/genksyms/genksyms.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index d17b7a2b941f..4a350816a9e8 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c @@ -156,7 +156,7 @@ static enum symbol_type map_to_ns(enum symbol_type t) return t; } -struct symbol *find_symbol(const char *name, enum symbol_type ns) +struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact) { unsigned long h = crc32(name) % HASH_BUCKETS; struct symbol *sym; @@ -167,6 +167,8 @@ struct symbol *find_symbol(const char *name, enum symbol_type ns) sym->is_declared) break; + if (exact && sym && sym->type != ns) + return NULL; return sym; } @@ -511,7 +513,7 @@ static unsigned long expand_and_crc_sym(struct symbol *sym, unsigned long crc) break; case SYM_TYPEDEF: - subsym = find_symbol(cur->string, cur->tag); + subsym = find_symbol(cur->string, cur->tag, 0); /* FIXME: Bad reference files can segfault here. */ if (subsym->expansion_trail) { if (flag_dump_defs) @@ -528,7 +530,7 @@ static unsigned long expand_and_crc_sym(struct symbol *sym, unsigned long crc) case SYM_STRUCT: case SYM_UNION: case SYM_ENUM: - subsym = find_symbol(cur->string, cur->tag); + subsym = find_symbol(cur->string, cur->tag, 0); if (!subsym) { struct string_list *n; @@ -582,7 +584,7 @@ void export_symbol(const char *name) { struct symbol *sym; - sym = find_symbol(name, SYM_NORMAL); + sym = find_symbol(name, SYM_NORMAL, 0); if (!sym) error_with_pos("export undefined symbol %s", name); else { |