From patchwork Sat Sep 27 09:10:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 3010 Received: (qmail 30835 invoked by alias); 27 Sep 2014 09:10:46 -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 30804 invoked by uid 89); 27 Sep 2014 09:10:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pd0-f173.google.com Received: from mail-pd0-f173.google.com (HELO mail-pd0-f173.google.com) (209.85.192.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 27 Sep 2014 09:10:41 +0000 Received: by mail-pd0-f173.google.com with SMTP id w10so4684434pde.4 for ; Sat, 27 Sep 2014 02:10:40 -0700 (PDT) X-Received: by 10.68.215.67 with SMTP id og3mr39990177pbc.30.1411809040079; Sat, 27 Sep 2014 02:10:40 -0700 (PDT) Received: from [192.168.1.100] ([223.72.65.108]) by mx.google.com with ESMTPSA id xt10sm7035260pab.44.2014.09.27.02.10.36 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 27 Sep 2014 02:10:39 -0700 (PDT) Message-ID: <54267F0D.3070409@gmail.com> Date: Sat, 27 Sep 2014 17:10:37 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: amodra@gmail.com, Joel Brobecker , Pedro Alves CC: gbenson@redhat.com, dje@google.com, gdb-patches@sourceware.org, binutils@sourceware.org Subject: [PATCH] gdb/c-lang.c: Remove useless "err = 0; " instruction in c_get_string() 'err' only has effect within a code block, so declare it within the code block, and remove useless "err = 0;" instruction. gdb/ 2014-09-27 Chen Gang * c-lang.c (c_get_string): Remove useless "err = 0;" instruction. --- gdb/c-lang.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 185b38e..418b8bd 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -241,7 +241,7 @@ c_get_string (struct value *value, gdb_byte **buffer, int *length, struct type **char_type, const char **charset) { - int err, width; + int width; unsigned int fetchlimit; struct type *type = check_typedef (value_type (value)); struct type *element_type = TYPE_TARGET_TYPE (type); @@ -305,10 +305,10 @@ c_get_string (struct value *value, gdb_byte **buffer, *length = i * width; *buffer = xmalloc (*length); memcpy (*buffer, contents, *length); - err = 0; } else { + int err; CORE_ADDR addr = value_as_address (value); /* Prior to the fix for PR 16196 read_string would ignore fetchlimit