ide/atapi: fix set but unused
PATCH 1/1 ide/atapi: fix set but unused
--- hw/ide/atapi.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
hw/ide/atapi.c +3 -1
@@ -1080,12 +1080,14 @@ static const struct {void ide_atapi_cmd (IDEState *s) { +#ifdef DEBUG_IDE_ATAPI const uint8_t *packet; +#endif uint8_t *buf; - packet = s->io_buffer; buf = s->io_buffer;#ifdef DEBUG_IDE_ATAPI + packet = s->io_buffer; {int i;printf ("ATAPI limit=0x%x packet:" , s->lcyl | (s->hcyl <<8 ));
Signature · 1 line
1.7.4.4
Quoted 15 lines · Alon Levy
Signed-off-by Alon Levy<[email protected]>--- hw/ide/atapi.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)hw/ide/atapi.c +1
-0@@ -1080,12 +1080,14 @@ static const struct {void ide_atapi_cmd (IDEState *s) { +#ifdef DEBUG_IDE_ATAPI const uint8_t *packet;
hw/ide/atapi.c static const struct { · line 1093
Quoted 10 lines
hw/ide/atapi.c +2
-1+#endif uint8_t *buf; - packet = s->io_buffer; buf = s->io_buffer;#ifdef DEBUG_IDE_ATAPI + packet = s->io_buffer; {int i;printf ("ATAPI limit=0x%x packet:" , s->lcyl | (s->hcyl<<8 ));
ACK
... but why don't we allow interspersing declarations and statements? There are already so many C99 and GCC extensions in use in QEMU.
Paolo
Am 28.04.2011 14:07, schrieb Paolo Bonzini:
Quoted 29 lines · Alon Levy
Quoted 15 lines
Signed-off-by Alon Levy<[email protected]>--- hw/ide/atapi.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)hw/ide/atapi.c +1
-0@@ -1080,12 +1080,14 @@ static const struct {void ide_atapi_cmd (IDEState *s) { +#ifdef DEBUG_IDE_ATAPI const uint8_t *packet;hw/ide/atapi.c static const struct { · line 1093
Quoted 10 lines
hw/ide/atapi.c +2
-1+#endif uint8_t *buf; - packet = s->io_buffer; buf = s->io_buffer;#ifdef DEBUG_IDE_ATAPI + packet = s->io_buffer; {int i;printf ("ATAPI limit=0x%x packet:" , s->lcyl | (s->hcyl<<8 ));ACK
Quoted 3 lines
... but why don't we allow interspersing declarations and statements? There are already so many C99 and GCC extensions in use in QEMU.
Paolo
What about using buf instead of packet (no need for extensions, reduces code by 4 lines)?
Stefan W.
Quoted 3 lines · Stefan Weil
What about using buf instead of packet (no need for extensions, reduces code by 4 lines)?
Uh, you're right!... I was assuming some side effect later, but after the refactoring this is indeed the only place where packet is used in the function, and it could use buf.
Paolo
PATCH v2 1/1 ide/atapi: fix set but unused
--- hw/ide/atapi.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
hw/ide/atapi.c +1 -3
@@ -1080,17 +1080,15 @@ static const struct {void ide_atapi_cmd (IDEState *s) { -const uint8_t *packet;uint8_t *buf; - packet = s->io_buffer; buf = s->io_buffer;#ifdef DEBUG_IDE_ATAPI {int i;printf ("ATAPI limit=0x%x packet:" , s->lcyl | (s->hcyl <<8 ));for (i =0 ; i <ATAPI_PACKET_SIZE ; i++) { -printf (" %02x" , packet[i]); +printf (" %02x" , buf[i]); }printf ("\n" ); }
Signature · 1 line
1.7.4.4
Am 28.04.2011 15:34, schrieb Alon Levy:
Quoted 19 lines
Signed-off-by Alon Levy<[email protected]>--- hw/ide/atapi.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)hw/ide/atapi.c +0
-2@@ -1080,17 +1080,15 @@ static const struct {void ide_atapi_cmd (IDEState *s) { -const uint8_t *packet;uint8_t *buf; - packet = s->io_buffer; buf = s->io_buffer;
hw/ide/atapi.c static const struct { · line 1094
Quoted 10 lines
hw/ide/atapi.c +1
-1#ifdef DEBUG_IDE_ATAPI {int i;printf ("ATAPI limit=0x%x packet:" , s->lcyl | (s->hcyl<<8 ));for (i =0 ; i<ATAPI_PACKET_SIZE ; i++) { -printf (" %02x" , packet[i]); +printf (" %02x" , buf[i]); }printf ("\n" ); }
Kevin Wolf
AppliedAm 28.04.2011 15:34, schrieb Alon Levy:
Quoted 4 lines
Signed-off-by Alon Levy <[email protected]>--- hw/ide/atapi.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
Thanks, applied to the block branch.
Kevin