qemu-ppc
[Top][All Lists]
Advanced

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

Re: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style


From: Zhao Liu
Subject: Re: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style
Date: Thu, 22 Feb 2024 17:12:20 +0800

Hi Philippe,

On Fri, Feb 16, 2024 at 12:02:52PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:02:52 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style
> X-Mailer: git-send-email 2.41.0
> 
> QEMU's coding style generally forbids C99 mixed declarations.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/i386/pc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 196827531a..3c00a87317 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1227,6 +1227,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
>       */
>      if (pcms->hpet_enabled) {
>          qemu_irq rtc_irq;
> +        uint8_t compat;
>  
>          hpet = qdev_try_new(TYPE_HPET);
>          if (!hpet) {
> @@ -1238,8 +1239,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
>           * use IRQ16~23, IRQ8 and IRQ2.  If the user has already set
>           * the property, use whatever mask they specified.
>           */
> -        uint8_t compat = object_property_get_uint(OBJECT(hpet),
> -                HPET_INTCAP, NULL);
> +        compat = object_property_get_uint(OBJECT(hpet), HPET_INTCAP, NULL);
>          if (!compat) {
>              qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs);
>          }

"compat" is only used here to check. So, what about getting rid of this
variable?

if (!object_property_get_uint(OBJECT(hpet), HPET_INTCAP, NULL)) {
    qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs);
}




reply via email to

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