Re: [PATCH v3 02/18] qemu: replace a lot of "def->controllers[i]" with equivalent "cont"

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

 



On Tue, 2016-09-20 at 15:14 -0400, Laine Stump wrote:
> There's no functional change here. This pointer was just used so many
> times that the extra long lines became annoying.
> ---
>  src/qemu/qemu_domain_address.c | 100 +++++++++++++++++++++--------------------
>  1 file changed, 51 insertions(+), 49 deletions(-)
[...]
> @@ -798,21 +800,21 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
>                      if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr,
>                                                         flags, false, true) < 0)
>                          goto cleanup;
> -                    def->controllers[i]->info.type
> +                    cont->info.type
>                          = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;

You can now join this line with the one above it :)

> -                    def->controllers[i]->info.addr.pci.domain = 0;
> -                    def->controllers[i]->info.addr.pci.bus = 0;
> -                    def->controllers[i]->info.addr.pci.slot = tmp_addr.slot;
> -                    def->controllers[i]->info.addr.pci.function = 0;
> -                    def->controllers[i]->info.addr.pci.multi
> +                    cont->info.addr.pci.domain = 0;
> +                    cont->info.addr.pci.bus = 0;
> +                    cont->info.addr.pci.slot = tmp_addr.slot;
> +                    cont->info.addr.pci.function = 0;
> +                    cont->info.addr.pci.multi
>                         = VIR_TRISTATE_SWITCH_ON;

Same here.

[...]
> @@ -1014,9 +1018,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
>               * controller/bus to connect it to on the upstream side.
>               */
>              flags = virDomainPCIControllerModelToConnectType(model);
> -            if (virDomainPCIAddressReserveNextSlot(addrs,
> -                                                   &def->controllers[i]->info,
> -                                                   flags) < 0)
> +            if (virDomainPCIAddressReserveNextSlot(addrs, &cont->info, flags) < 0)

This is >80 columns, so "flags) < 0)" will have to remain
on its own line.

[...]
> @@ -1147,12 +1151,10 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
>                                                 false, foundAddr) < 0)
>                  goto error;
>  
> -            def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
> -            def->controllers[i]->info.addr.pci = addr;
> +            cont->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
> +            cont->info.addr.pci = addr;
>          } else {
> -            if (virDomainPCIAddressReserveNextSlot(addrs,
> -                                                   &def->controllers[i]->info,
> -                                                   flags) < 0)
> +            if (virDomainPCIAddressReserveNextSlot(addrs, &cont->info, flags) < 0)

Same here.

ACK once you address the comments above.

-- 
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]