This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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  <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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]