diff options
-rw-r--r-- | dissect.c | 4 | ||||
-rw-r--r-- | test-dissect.c | 7 |
2 files changed, 5 insertions, 6 deletions
@@ -125,7 +125,7 @@ static inline struct symbol *no_member(struct ident *name) }; sym.ctype.base_type = &bad_ctype; - sym.ident = name; + sym.ident = name ?: built_in_ident("?"); return &sym; } @@ -135,7 +135,7 @@ static struct symbol *report_member(usage_t mode, struct position *pos, { struct symbol *ret = mem->ctype.base_type; - if (reporter->r_member) + if (mem->ident && reporter->r_member) reporter->r_member(fix_mode(ret, mode), pos, type, mem); return ret; diff --git a/test-dissect.c b/test-dissect.c index 266148be..af1212a0 100644 --- a/test-dissect.c +++ b/test-dissect.c @@ -56,14 +56,13 @@ static void r_symbol(unsigned mode, struct position *pos, struct symbol *sym) static void r_member(unsigned mode, struct position *pos, struct symbol *sym, struct symbol *mem) { - struct ident *ni, *si, *mi; + struct ident *si, *mi; print_usage(pos, sym, mode); - ni = built_in_ident("?"); - si = sym->ident ?: ni; + si = sym->ident ?: built_in_ident("?"); /* mem == NULL means entire struct accessed */ - mi = mem ? (mem->ident ?: ni) : built_in_ident("*"); + mi = mem ? mem->ident : built_in_ident("*"); printf("%.*s.%-*.*s %s\n", si->len, si->name, |