This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/7] check_types_equal: short circuit check if identical pointers are used
- From: jeffm at suse dot com
- To: gdb-patches at sourceware dot org
- Cc: Jeff Mahoney <jeffm at suse dot com>
- Date: Thu, 4 Feb 2016 12:29:27 -0500
- Subject: [PATCH 1/7] check_types_equal: short circuit check if identical pointers are used
- Authentication-results: sourceware.org; auth=none
- References: <1454606973-31017-1-git-send-email-jeffm at suse dot com>
From: Jeff Mahoney <jeffm@suse.com>
If two types share identical pointers, we don't need to check typedefs
before comparing the result.
---
gdb/gdbtypes.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b9850cf..1b6f276 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3218,6 +3218,9 @@ static int
check_types_equal (struct type *type1, struct type *type2,
VEC (type_equality_entry_d) **worklist)
{
+ if (type1 == type2)
+ return 1;
+
type1 = check_typedef (type1);
type2 = check_typedef (type2);
--
2.1.4