summaryrefslogtreecommitdiff
path: root/gdb/c-valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-03-13 17:39:52 -0600
committerTom Tromey <tom@tromey.com>2020-03-13 18:03:40 -0600
commit7fe471e9ae8dbc61b898f7572fed31c4224a0b89 (patch)
treeb20ea72a34fcc40607255d2e86f82967c1dc8601 /gdb/c-valprint.c
parentd121c6ce897d34ae168f78cbdacacb109d4833e6 (diff)
downloadbinutils-gdb-7fe471e9ae8dbc61b898f7572fed31c4224a0b89.tar.gz
Simplify c_val_print_array
This slightly simplifies c_val_print_array by moving a variable to a more inner scope and removing a dead assignment. gdb/ChangeLog 2020-03-13 Tom Tromey <tom@tromey.com> * c-valprint.c (c_val_print_array): Simplify.
Diffstat (limited to 'gdb/c-valprint.c')
-rw-r--r--gdb/c-valprint.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 759ab43c723..bee0c18abf8 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -247,7 +247,6 @@ c_val_print_array (struct type *type, const gdb_byte *valaddr,
LONGEST low_bound, high_bound;
int eltlen, len;
enum bfd_endian byte_order = type_byte_order (type);
- unsigned int i = 0; /* Number of characters printed. */
if (!get_array_bounds (type, &low_bound, &high_bound))
error (_("Could not determine the array high bound"));
@@ -307,10 +306,10 @@ c_val_print_array (struct type *type, const gdb_byte *valaddr,
LA_PRINT_STRING (stream, unresolved_elttype,
valaddr + embedded_offset * unit_size, len,
NULL, force_ellipses, options);
- i = len;
}
else
{
+ unsigned int i = 0;
fprintf_filtered (stream, "{");
/* If this is a virtual function table, print the 0th
entry specially, and the rest of the members
@@ -321,10 +320,6 @@ c_val_print_array (struct type *type, const gdb_byte *valaddr,
fprintf_filtered (stream, _("%d vtable entries"),
len - 1);
}
- else
- {
- i = 0;
- }
val_print_array_elements (type, embedded_offset,
address, stream,
recurse, original_value, options, i);