[binutils-gdb] Trivially simplify rust_language::print_enum
Tom Tromey
tromey@sourceware.org
Thu Feb 9 19:22:31 GMT 2023
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8ac460b742bc7f49acbcd78f8822386f56814055
commit 8ac460b742bc7f49acbcd78f8822386f56814055
Author: Tom Tromey <tom@tromey.com>
Date: Thu Feb 9 12:13:08 2023 -0700
Trivially simplify rust_language::print_enum
rust_language::print_enum computes:
int nfields = variant_type->num_fields ();
... but then does not reuse this in one spot. This patch corrects the
oversight.
Diff:
---
gdb/rust-lang.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 6653f7a9c64..f2017f95211 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -495,7 +495,7 @@ rust_language::print_enum (struct value *val, struct ui_file *stream,
}
bool first_field = true;
- for (int j = 0; j < variant_type->num_fields (); j++)
+ for (int j = 0; j < nfields; j++)
{
if (!first_field)
gdb_puts (", ", stream);
More information about the Gdb-cvs
mailing list