[pushed] Simplify ada_identical_enum_types_p
Checks
Commit Message
This patch changes ada_identical_enum_types_p to reuse the field names
that are computed earlier in the loop. This is a simple cleanup, but
also is useful for a larger change that I'm working on.
Tested on x86-64 Fedora 38.
---
gdb/ada-lang.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
@@ -4996,12 +4996,9 @@ ada_identical_enum_types_p (struct type *type1, struct type *type2)
int len_1 = strlen (name_1);
int len_2 = strlen (name_2);
- ada_remove_trailing_digits (type1->field (i).name (), &len_1);
- ada_remove_trailing_digits (type2->field (i).name (), &len_2);
- if (len_1 != len_2
- || strncmp (type1->field (i).name (),
- type2->field (i).name (),
- len_1) != 0)
+ ada_remove_trailing_digits (name_1, &len_1);
+ ada_remove_trailing_digits (name_2, &len_2);
+ if (len_1 != len_2 || strncmp (name_1, name_2, len_1) != 0)
return 0;
}