This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] gdb/c-lang.c: Remove useless "err = 0;" instruction in c_get_string()
- From: Chen Gang <gang dot chen dot 5i5j at gmail dot com>
- To: amodra at gmail dot com, Joel Brobecker <brobecker at adacore dot com>, Pedro Alves <palves at redhat dot com>
- Cc: gbenson at redhat dot com, dje at google dot com, gdb-patches at sourceware dot org, binutils at sourceware dot org
- Date: Sat, 27 Sep 2014 17:10:37 +0800
- Subject: [PATCH] gdb/c-lang.c: Remove useless "err = 0;" instruction in c_get_string()
- Authentication-results: sourceware.org; auth=none
'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