projects
/
binutils-gdb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b695fdd
)
Trivially simplify rust_language::print_enum
author
Tom Tromey
<tom@tromey.com>
Thu, 9 Feb 2023 19:13:08 +0000
(12:13 -0700)
committer
Tom Tromey
<tom@tromey.com>
Thu, 9 Feb 2023 19:17:13 +0000
(12:17 -0700)
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.
gdb/rust-lang.c
patch
|
blob
|
history
diff --git
a/gdb/rust-lang.c
b/gdb/rust-lang.c
index 6653f7a9c648856aec3311caa96f0cb3d38ae4e6..f2017f952118d95a16eea7e19579d02a8456ba83 100644
(file)
--- 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);