diff options
author | Tom Tromey <tromey@adacore.com> | 2024-08-26 13:29:04 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2024-08-26 13:29:04 -0600 |
commit | 16ffddc6b9985addd98e3e92fe5733df3ea66f00 (patch) | |
tree | b440465373625cbafa437f9b92b4540a96a73615 | |
parent | 91555eddd48726592478fc3fbe4a4dbce31384bf (diff) | |
download | gdb-16ffddc6b9985addd98e3e92fe5733df3ea66f00.zip gdb-16ffddc6b9985addd98e3e92fe5733df3ea66f00.tar.gz gdb-16ffddc6b9985addd98e3e92fe5733df3ea66f00.tar.bz2 |
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.
-rw-r--r-- | gdb/ada-lang.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 7853a48..83794f9 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; } |