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.
This commit is contained in:
parent
d121c6ce89
commit
7fe471e9ae
|
@ -1,3 +1,7 @@
|
||||||
|
2020-03-13 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* c-valprint.c (c_val_print_array): Simplify.
|
||||||
|
|
||||||
2020-03-13 Tom Tromey <tom@tromey.com>
|
2020-03-13 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* valprint.c (value_print_array_elements): New function.
|
* valprint.c (value_print_array_elements): New function.
|
||||||
|
|
|
@ -247,7 +247,6 @@ c_val_print_array (struct type *type, const gdb_byte *valaddr,
|
||||||
LONGEST low_bound, high_bound;
|
LONGEST low_bound, high_bound;
|
||||||
int eltlen, len;
|
int eltlen, len;
|
||||||
enum bfd_endian byte_order = type_byte_order (type);
|
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))
|
if (!get_array_bounds (type, &low_bound, &high_bound))
|
||||||
error (_("Could not determine the array 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,
|
LA_PRINT_STRING (stream, unresolved_elttype,
|
||||||
valaddr + embedded_offset * unit_size, len,
|
valaddr + embedded_offset * unit_size, len,
|
||||||
NULL, force_ellipses, options);
|
NULL, force_ellipses, options);
|
||||||
i = len;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
fprintf_filtered (stream, "{");
|
fprintf_filtered (stream, "{");
|
||||||
/* If this is a virtual function table, print the 0th
|
/* If this is a virtual function table, print the 0th
|
||||||
entry specially, and the rest of the members
|
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"),
|
fprintf_filtered (stream, _("%d vtable entries"),
|
||||||
len - 1);
|
len - 1);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
i = 0;
|
|
||||||
}
|
|
||||||
val_print_array_elements (type, embedded_offset,
|
val_print_array_elements (type, embedded_offset,
|
||||||
address, stream,
|
address, stream,
|
||||||
recurse, original_value, options, i);
|
recurse, original_value, options, i);
|
||||||
|
|
Loading…
Reference in New Issue