Re: [PATCH v4 03/25] [NEW] qemu: replace "def->nets[i]" with "net" and "def->sounds[i]" with "sound"

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

 



On Fri, 2016-10-14 at 15:53 -0400, Laine Stump wrote:
> More occurences of repeatedly dereferencing the same pointer stored in
> an array are replaced with the definition of a temporary pointer that
> is then used directly. No functional change.
> ---
>  src/qemu/qemu_domain_address.c | 41 +++++++++++++++++++++++------------------
>  1 file changed, 23 insertions(+), 18 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
> index e6abadf..d2a3237 100644
> --- a/src/qemu/qemu_domain_address.c
> +++ b/src/qemu/qemu_domain_address.c
> @@ -211,11 +211,12 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
>      /* Default values match QEMU. See spapr_(llan|vscsi|vty).c */
>  
>      for (i = 0; i < def->nnets; i++) {
> -        if (def->nets[i]->model &&
> -            STREQ(def->nets[i]->model, "spapr-vlan"))
> -            def->nets[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
> -        if (qemuDomainAssignSpaprVIOAddress(def, &def->nets[i]->info,
> -                                            VIO_ADDR_NET) < 0)
> +        virDomainNetDefPtr net = def->nets[i];
> +
> +        if (net->model &&
> +            STREQ(net->model, "spapr-vlan"))
> +            net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;

Our coding style requires brackets here, please add them.

[...]
>      /* Sound cards */
>      for (i = 0; i < def->nsounds; i++) {
> -        if (!virDeviceInfoPCIAddressWanted(&def->sounds[i]->info))
> +        virDomainSoundDefPtr sound = def->sounds[i];
> +
> +        if (!virDeviceInfoPCIAddressWanted(&sound->info))
>              continue;
>          /* Skip ISA sound card, PCSPK and usb-audio */
> -        if (def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_SB16 ||
> -            def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_PCSPK ||
> -            def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_USB)
> +        if (sound->model == VIR_DOMAIN_SOUND_MODEL_SB16 ||
> +            sound->model == VIR_DOMAIN_SOUND_MODEL_PCSPK ||
> +            sound->model == VIR_DOMAIN_SOUND_MODEL_USB)
>              continue;

This one needs brackets as well.

ACK with those nits fixed.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]