gdb/c-lang.c: Remove useless "err = 0;" instruction in c_get_string()
Commit Message
'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
> '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.
@@ -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