From: Chen Gang <gang.chen.5i5j@gmail.com>
To: amodra@gmail.com, Joel Brobecker <brobecker@adacore.com>,
Pedro Alves <palves@redhat.com>
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()
Date: Sat, 27 Sep 2014 09:10:00 -0000 [thread overview]
Message-ID: <54267F0D.3070409@gmail.com> (raw)
'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 <gang.chen.5i5j@gmail.com>
* 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
--
1.7.11.7
next reply other threads:[~2014-09-27 9:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-27 9:10 Chen Gang [this message]
2014-09-28 0:46 ` Joel Brobecker
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=54267F0D.3070409@gmail.com \
--to=gang.chen.5i5j@gmail.com \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=brobecker@adacore.com \
--cc=dje@google.com \
--cc=gbenson@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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