qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Remove typedef for bool from eepro100.c


From: Reimar Döffinger
Subject: Re: [Qemu-devel] [PATCH] Remove typedef for bool from eepro100.c
Date: Thu, 27 Aug 2009 14:45:46 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Thu, Aug 27, 2009 at 06:01:24PM +0530, Amit Shah wrote:
> eepro100.c shouldn't have the need to do this in its local header file.
> 
> And I recently started getting this:
> 
> $ make -j3
> ...
>   CC    x86_64-softmmu/eepro100.o
> /home/amit/src/qemu/hw/eepro100.c:112: error: two or more data types
> in declaration specifiers
> /home/amit/src/qemu/hw/eepro100.c:112: warning: useless type name in
> empty declaration
> make[1]: *** [eepro100.o] Error 1
> 
> so just remove the typedef and include <stdbool.h> instead.
> 
> Signed-off-by: Amit Shah <address@hidden>
> ---
>  hw/eepro100.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/eepro100.c b/hw/eepro100.c
> index 8988b3f..0634f8c 100644
> --- a/hw/eepro100.c
> +++ b/hw/eepro100.c
> @@ -38,6 +38,7 @@
>  #endif
>  
>  #include <stddef.h>             /* offsetof */
> +#include <stdbool.h>
>  #include "hw.h"
>  #include "pci.h"
>  #include "net.h"
> @@ -109,8 +110,6 @@
>  #define INT_MASK        0x0100
>  #define DRVR_INT        0x0200  /* Driver generated interrupt. */
>  
> -typedef unsigned char bool;
> -

I doubt it matters much, but
1) stdbool bool is probably 4 bytes, not just 1 like char
2) all assignments to bool variable are converted to 0/1 which could
make a speed difference (not here since the code actually does that
explicitly).
3) is stdbool.h available everywhere where qemu is supposed to compile?

I suggest to just get rid of bool in this file, it is only used in 5
places, i.e. change
>        bool bit_el = ((command & 0x8000) != 0);
to
>        int bit_el = command & 0x8000;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]