summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2015-07-09 11:15:40 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2015-07-09 11:24:56 -0400
commitf6b93c346364866f96529fb03557eb43e0434fa5 (patch)
tree46ea0fbc663b9ddcad10aa7ebfc4d700470734ec
parentde231f2015ec537df22c60822c9adb1f2205c13e (diff)
downloadbinutils-gdb-f6b93c346364866f96529fb03557eb43e0434fa5.tar.gz
Remove unneeded variable assignment
The assignment to i in the TYPE_CODE_PTR section is not useful. Removing it allows to move i in a narrower scope, which will help things somewhere in the next patches. gdb/ChangeLog: * c-valprint.c (c_val_print): Remove an assignment to i and move its declaration.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/c-valprint.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c7d0ddc0505..443565a765d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-09 Simon Marchi <simon.marchi@ericsson.com>
+
+ * c-valprint.c (c_val_print): Remove an assignment to i and move
+ its declaration.
+
2015-07-09 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-nat.c (aarch64_linux_get_debug_reg_capacity): Add
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 8d8b7447516..e8a2fc70199 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -139,7 +139,6 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
{
struct gdbarch *gdbarch = get_type_arch (type);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- unsigned int i = 0; /* Number of characters printed. */
unsigned len;
struct type *elttype, *unresolved_elttype;
struct type *unresolved_type = type;
@@ -149,6 +148,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
CHECK_TYPEDEF (type);
switch (TYPE_CODE (type))
{
+ unsigned int i = 0; /* Number of characters printed. */
case TYPE_CODE_ARRAY:
unresolved_elttype = TYPE_TARGET_TYPE (type);
elttype = check_typedef (unresolved_elttype);
@@ -300,9 +300,9 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
{
if (want_space)
fputs_filtered (" ", stream);
- i = val_print_string (unresolved_elttype, NULL,
- addr, -1,
- stream, options);
+ val_print_string (unresolved_elttype, NULL,
+ addr, -1,
+ stream, options);
}
else if (cp_is_vtbl_member (type))
{