* [PATCH] gdb/c-lang.c: Remove useless "err = 0;" instruction in c_get_string()
@ 2014-09-27 9:10 Chen Gang
2014-09-28 0:46 ` Joel Brobecker
0 siblings, 1 reply; 2+ messages in thread
From: Chen Gang @ 2014-09-27 9:10 UTC (permalink / raw)
To: amodra, Joel Brobecker, Pedro Alves; +Cc: gbenson, dje, gdb-patches, binutils
'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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gdb/c-lang.c: Remove useless "err = 0;" instruction in c_get_string()
2014-09-27 9:10 [PATCH] gdb/c-lang.c: Remove useless "err = 0;" instruction in c_get_string() Chen Gang
@ 2014-09-28 0:46 ` Joel Brobecker
0 siblings, 0 replies; 2+ messages in thread
From: Joel Brobecker @ 2014-09-28 0:46 UTC (permalink / raw)
To: Chen Gang; +Cc: amodra, Pedro Alves, gbenson, dje, gdb-patches, binutils
> '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.
--
Joel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-28 0:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-27 9:10 [PATCH] gdb/c-lang.c: Remove useless "err = 0;" instruction in c_get_string() Chen Gang
2014-09-28 0:46 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox