This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] gdbtypes.c (lookup_typename): Simplify.
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Wed, 23 May 2012 16:46:45 -0700 (PDT)
- Subject: [commit] gdbtypes.c (lookup_typename): Simplify.
Hi.
This function was harder to read than it should be,
so I've committed this.
Regression tested on amd64-linux.
2012-05-23 Doug Evans <dje@google.com>
* gdbtypes.c (lookup_typename): Simplify.
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.229
diff -u -p -r1.229 gdbtypes.c
--- gdbtypes.c 18 Apr 2012 06:46:46 -0000 1.229
+++ gdbtypes.c 23 May 2012 21:30:40 -0000
@@ -1143,23 +1143,16 @@ lookup_typename (const struct language_d
struct type *tmp;
sym = lookup_symbol (name, block, VAR_DOMAIN, 0);
- if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
- {
- tmp = language_lookup_primitive_type_by_name (language, gdbarch, name);
- if (tmp)
- {
- return tmp;
- }
- else if (!tmp && noerr)
- {
- return NULL;
- }
- else
- {
- error (_("No type named %s."), name);
- }
- }
- return (SYMBOL_TYPE (sym));
+ if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+ return SYMBOL_TYPE (sym);
+
+ tmp = language_lookup_primitive_type_by_name (language, gdbarch, name);
+ if (tmp)
+ return tmp;
+
+ if (noerr)
+ return NULL;
+ error (_("No type named %s."), name);
}
struct type *