This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/7] check_types_equal: short circuit check if identical pointers are used


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]