qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ide/atapi: fix set but unused
@ 2011-04-28  8:07 Alon Levy
  2011-04-28 12:07 ` Paolo Bonzini
  0 siblings, 1 reply; 7+ messages in thread
From: Alon Levy @ 2011-04-28  8:07 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/ide/atapi.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 690a0ab..81fa01b 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -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));
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] ide/atapi: fix set but unused
  2011-04-28  8:07 [Qemu-devel] [PATCH] ide/atapi: fix set but unused Alon Levy
@ 2011-04-28 12:07 ` Paolo Bonzini
  2011-04-28 12:16   ` Stefan Weil
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2011-04-28 12:07 UTC (permalink / raw)
  To: Alon Levy; +Cc: qemu-devel

On 04/28/2011 10:07 AM, Alon Levy wrote:
> Signed-off-by: Alon Levy<alevy@redhat.com>
> ---
>   hw/ide/atapi.c |    4 +++-
>   1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
> index 690a0ab..81fa01b 100644
> --- a/hw/ide/atapi.c
> +++ b/hw/ide/atapi.c
> @@ -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));

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] ide/atapi: fix set but unused
  2011-04-28 12:07 ` Paolo Bonzini
@ 2011-04-28 12:16   ` Stefan Weil
  2011-04-28 12:35     ` Paolo Bonzini
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2011-04-28 12:16 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Alon Levy, qemu-devel

Am 28.04.2011 14:07, schrieb Paolo Bonzini:
> On 04/28/2011 10:07 AM, Alon Levy wrote:
>> Signed-off-by: Alon Levy<alevy@redhat.com>
>> ---
>>   hw/ide/atapi.c |    4 +++-
>>   1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
>> index 690a0ab..81fa01b 100644
>> --- a/hw/ide/atapi.c
>> +++ b/hw/ide/atapi.c
>> @@ -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));
>
> 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

What about using buf instead of packet (no need for extensions, reduces 
code by 4 lines)?

Stefan W.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] ide/atapi: fix set but unused
  2011-04-28 12:16   ` Stefan Weil
@ 2011-04-28 12:35     ` Paolo Bonzini
  2011-04-28 13:34       ` [Qemu-devel] [PATCHv2] " Alon Levy
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2011-04-28 12:35 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Alon Levy, qemu-devel

On 04/28/2011 02:16 PM, Stefan Weil wrote:
>
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCHv2] ide/atapi: fix set but unused
  2011-04-28 12:35     ` Paolo Bonzini
@ 2011-04-28 13:34       ` Alon Levy
  2011-04-28 14:46         ` Stefan Weil
  2011-04-29 10:58         ` Kevin Wolf
  0 siblings, 2 replies; 7+ messages in thread
From: Alon Levy @ 2011-04-28 13:34 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/ide/atapi.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 690a0ab..0073c8d 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -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");
     }
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCHv2] ide/atapi: fix set but unused
  2011-04-28 13:34       ` [Qemu-devel] [PATCHv2] " Alon Levy
@ 2011-04-28 14:46         ` Stefan Weil
  2011-04-29 10:58         ` Kevin Wolf
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Weil @ 2011-04-28 14:46 UTC (permalink / raw)
  To: Alon Levy; +Cc: qemu-devel

Am 28.04.2011 15:34, schrieb Alon Levy:
> Signed-off-by: Alon Levy<alevy@redhat.com>
> ---
>   hw/ide/atapi.c |    4 +---
>   1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
> index 690a0ab..0073c8d 100644
> --- a/hw/ide/atapi.c
> +++ b/hw/ide/atapi.c
> @@ -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");
>       }
>    

Acked-by: Stefan Weil <weil@mail.berlios.de>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCHv2] ide/atapi: fix set but unused
  2011-04-28 13:34       ` [Qemu-devel] [PATCHv2] " Alon Levy
  2011-04-28 14:46         ` Stefan Weil
@ 2011-04-29 10:58         ` Kevin Wolf
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2011-04-29 10:58 UTC (permalink / raw)
  To: Alon Levy; +Cc: qemu-devel

Am 28.04.2011 15:34, schrieb Alon Levy:
> Signed-off-by: Alon Levy <alevy@redhat.com>
> ---
>  hw/ide/atapi.c |    4 +---
>  1 files changed, 1 insertions(+), 3 deletions(-)

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-04-29 10:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-28  8:07 [Qemu-devel] [PATCH] ide/atapi: fix set but unused Alon Levy
2011-04-28 12:07 ` Paolo Bonzini
2011-04-28 12:16   ` Stefan Weil
2011-04-28 12:35     ` Paolo Bonzini
2011-04-28 13:34       ` [Qemu-devel] [PATCHv2] " Alon Levy
2011-04-28 14:46         ` Stefan Weil
2011-04-29 10:58         ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).