diff mbox

gdb/c-lang.c: Remove useless "err = 0;" instruction in c_get_string()

Message ID 54267F0D.3070409@gmail.com
State New
Headers show

Commit Message

Chen Gang Sept. 27, 2014, 9:10 a.m. UTC
'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(-)

Comments

Joel Brobecker Sept. 28, 2014, 12:46 a.m. UTC | #1
> '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.

Looks good to me. Go ahead and push.
diff mbox

Patch

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