diff mbox series

[2/2] dissect: kill no_member()

Message ID 20200212100437.GA23419@redhat.com (mailing list archive)
State Mainlined, archived
Headers show
Series [1/2] dissect: don't set ->ident = '?' in no_member() | expand

Commit Message

Oleg Nesterov Feb. 12, 2020, 10:04 a.m. UTC
It is trivial and has a single caller, lookup_member().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 dissect.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/dissect.c b/dissect.c
index 05bddc8..40baf64 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)