From: Tom Tromey Date: Mon, 26 Aug 2024 19:29:04 +0000 (-0600) Subject: Simplify ada_identical_enum_types_p X-Git-Tag: gdb-16-branchpoint~1074 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=16ffddc6b9985addd98e3e92fe5733df3ea66f00;p=thirdparty%2Fbinutils-gdb.git Simplify ada_identical_enum_types_p 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. --- diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 7853a482156..83794f97825 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -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; }