Re: [libvirt-designer PATCHv2 3/3] Rework disk bus type handling

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

 



On Fri, Apr 19, 2013 at 11:46:21AM +0200, Michal Privoznik wrote:
> On 18.04.2013 18:08, Christophe Fergeau wrote:
> > +static OsinfoDevice *
> > +gvir_designer_domain_get_fallback_disk_controller(GVirDesignerDomain *design,
> > +                                                  GError **error)
> > +{
> > +    OsinfoEntity *dev = NULL;
> > +    OsinfoDeviceList *devices;
> > +    OsinfoFilter *filter;
> > +    int virt_type;
> > +
> > +    filter = osinfo_filter_new();
> > +    osinfo_filter_add_constraint(filter, OSINFO_DEVICE_PROP_CLASS, "block");
> > +    devices = gvir_designer_domain_get_supported_devices(design, filter);
> > +    g_object_unref(G_OBJECT(filter));
> > +
> > +    if ((devices == NULL) ||
> > +        (osinfo_list_get_length(OSINFO_LIST(devices)) == 0)) {
> 
> No need for enclosing these two conditions in parentheses here ...
> 
> > +        goto cleanup;
> > +    }
> > +
> > +    virt_type = gvir_config_domain_get_virt_type(design->priv->config);
> > +    if ((virt_type == GVIR_CONFIG_DOMAIN_VIRT_QEMU) ||
> > +        (virt_type == GVIR_CONFIG_DOMAIN_VIRT_KQEMU) ||
> > +        (virt_type == GVIR_CONFIG_DOMAIN_VIRT_KVM)) {
> 
> ... here ...
> 
> > +        /* If using QEMU; we favour using virtio-block */
> > +        OsinfoList *tmp_devices;
> > +        filter = osinfo_filter_new();
> > +        osinfo_filter_add_constraint(filter,
> > +                                     OSINFO_ENTITY_PROP_ID,
> > +                                     GVIR_DESIGNER_VIRTIO_BLOCK_DEVICE_ID);
> > +        tmp_devices = osinfo_list_new_filtered(OSINFO_LIST(devices), filter);
> > +        if ((tmp_devices != NULL) &&
> > +            (osinfo_list_get_length(OSINFO_LIST(tmp_devices)) > 0)) {
> 
> ... and here.

I much prefer having parentheses around conditions, this saves me some
thinking effort with respect to operator priorities ;) I've removed the ()
in this patch, and in the sound/video patches from the other series I've
sent.

Christophe

Attachment: pgp2mljcYiWFX.pgp
Description: PGP signature

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