From patchwork Wed Jul 8 21:07:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 7596 Received: (qmail 5448 invoked by alias); 8 Jul 2015 21:08:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 5420 invoked by uid 89); 8 Jul 2015 21:08:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 08 Jul 2015 21:08:16 +0000 Received: from EUSAAHC005.ericsson.se (Unknown_Domain [147.117.188.87]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id F9.A4.07675.6E92D955; Wed, 8 Jul 2015 15:47:18 +0200 (CEST) Received: from elxcz23q12-y4.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.87) with Microsoft SMTP Server (TLS) id 14.3.210.2; Wed, 8 Jul 2015 17:08:10 -0400 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH 1/7] Remove unneeded variable assignment Date: Wed, 8 Jul 2015 17:07:03 -0400 Message-ID: <1436389629-18754-2-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1436389629-18754-1-git-send-email-simon.marchi@ericsson.com> References: <1436389629-18754-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes 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)) {