Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: [PATCH 1/7] Remove unneeded variable assignment
Date: Wed, 08 Jul 2015 21:08:00 -0000	[thread overview]
Message-ID: <1436389629-18754-2-git-send-email-simon.marchi@ericsson.com> (raw)
In-Reply-To: <1436389629-18754-1-git-send-email-simon.marchi@ericsson.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


  reply	other threads:[~2015-07-08 21:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-08 21:08 [PATCH 0/7] Split c_val_print Simon Marchi
2015-07-08 21:08 ` Simon Marchi [this message]
2015-07-08 21:08 ` [PATCH 2/7] Factor out print_unpacked_pointer from c_val_print Simon Marchi
2015-07-09 15:30   ` Simon Marchi
2015-07-08 21:08 ` [PATCH 7/7] Factor out memberptr printing code " Simon Marchi
2015-07-08 21:08 ` [PATCH 3/7] Factor out array " Simon Marchi
2015-07-08 21:08 ` [PATCH 6/7] Factor out int " Simon Marchi
2015-07-08 21:08 ` [PATCH 5/7] Factor out struct and union " Simon Marchi
2015-07-08 21:08 ` [PATCH 4/7] Factor out pointer " Simon Marchi
2015-07-09 15:32   ` Simon Marchi
2015-07-09 10:53 ` [PATCH 0/7] Split c_val_print Pedro Alves
2015-07-09 15:28   ` Simon Marchi
2015-07-09 15:30     ` Pedro Alves
2015-07-09 23:42 ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436389629-18754-2-git-send-email-simon.marchi@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox