This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/7] Remove unneeded variable assignment
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: Simon Marchi <simon dot marchi at ericsson dot com>
- Date: Wed, 8 Jul 2015 17:07:03 -0400
- Subject: [PATCH 1/7] Remove unneeded variable assignment
- Authentication-results: sourceware.org; auth=none
- References: <1436389629-18754-1-git-send-email-simon dot marchi at ericsson dot com>
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.
---
gdb/c-valprint.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 8d8b744..e8a2fc7 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))
{
--
2.1.4