aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2020-02-12 11:04:37 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-02-13 18:32:38 +0100
commit4201c46a529024189737323a4b35b1360a33313c (patch)
tree168193ac74622a47b3748f81a0aaa7d08c6d3fe0
parent9f207728de61eb503613dd960ff75aaa3fb73b36 (diff)
downloadsparse-4201c46a529024189737323a4b35b1360a33313c.tar.gz
dissect: kill no_member()
It is trivial and has a single caller, lookup_member(). Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--dissect.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/dissect.c b/dissect.c
index 05bddc80..40baf64f 100644
--- a/dissect.c
+++ b/dissect.c
@@ -119,19 +119,6 @@ static usage_t fix_mode(struct symbol *type, usage_t mode)
return mode;
}
-static inline struct symbol *no_member(struct ident *name)
-{
- static struct symbol sym = {
- .type = SYM_BAD,
- .ctype.base_type = &bad_ctype,
- .kind = 'm',
- };
-
- sym.ident = name;
-
- return &sym;
-}
-
static struct symbol *report_member(usage_t mode, struct position *pos,
struct symbol *type, struct symbol *mem)
{
@@ -308,8 +295,20 @@ found:
static struct symbol *lookup_member(struct symbol *type, struct ident *name, int *addr)
{
- return __lookup_member(type, name, addr)
- ?: no_member(name);
+ struct symbol *mem = __lookup_member(type, name, addr);
+
+ if (!mem) {
+ static struct symbol bad_member = {
+ .type = SYM_BAD,
+ .ctype.base_type = &bad_ctype,
+ .kind = 'm',
+ };
+
+ mem = &bad_member;
+ mem->ident = name;
+ }
+
+ return mem;
}
static struct expression *peek_preop(struct expression *expr, int op)