[PATCHv2 1/6] maint: Clean up coding style

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

 



Style changes split out from next patch.
---
 src/conf/domain_conf.c  |   23 +++++++++++++----------
 src/qemu/qemu_command.c |   19 +++++++++++--------
 src/qemu/qemu_driver.c  |    7 +++----
 3 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4f8c57a..89bae57 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8606,11 +8606,12 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
     }

     /* analysis of the disk devices */
-    if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0) {
+    if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0)
         goto error;
-    }
+
     if (n && VIR_ALLOC_N(def->disks, n) < 0)
         goto no_memory;
+
     for (i = 0 ; i < n ; i++) {
         virDomainDiskDefPtr disk = virDomainDiskDefParseXML(caps,
                                                             nodes[i],
@@ -8626,11 +8627,12 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
     VIR_FREE(nodes);

     /* analysis of the controller devices */
-    if ((n = virXPathNodeSet("./devices/controller", ctxt, &nodes)) < 0) {
+    if ((n = virXPathNodeSet("./devices/controller", ctxt, &nodes)) < 0)
         goto error;
-    }
+
     if (n && VIR_ALLOC_N(def->controllers, n) < 0)
         goto no_memory;
+
     for (i = 0 ; i < n ; i++) {
         virDomainControllerDefPtr controller = virDomainControllerDefParseXML(nodes[i],
                                                                               flags);
@@ -8752,9 +8754,9 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
     }
     VIR_FREE(nodes);

-    if ((n = virXPathNodeSet("./devices/serial", ctxt, &nodes)) < 0) {
+    if ((n = virXPathNodeSet("./devices/serial", ctxt, &nodes)) < 0)
         goto error;
-    }
+
     if (n && VIR_ALLOC_N(def->serials, n) < 0)
         goto no_memory;

@@ -9048,8 +9050,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
         goto error;
     }
     if (n > 1) {
-        virDomainReportError (VIR_ERR_INTERNAL_ERROR,
-                              "%s", _("only a single watchdog device is supported"));
+        virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                             _("only a single watchdog device is supported"));
         goto error;
     }
     if (n > 0) {
@@ -9068,8 +9070,9 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
         goto error;
     }
     if (n > 1) {
-        virDomainReportError (VIR_ERR_INTERNAL_ERROR,
-                              "%s", _("only a single memory balloon device is supported"));
+        virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                             _("only a single memory balloon device is "
+                               "supported"));
         goto error;
     }
     if (n > 0) {
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ae48678..16fa294 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4788,25 +4788,28 @@ qemuBuildCommandLine(virConnectPtr conn,
             /* Only recent QEMU implements a SATA (AHCI) controller */
             if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
                 if (!qemuCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) {
-                    qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                                    "%s", _("SATA is not supported with this QEMU binary"));
+                    qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                    _("SATA is not supported with this "
+                                      "QEMU binary"));
                     goto error;
                 } else {
                     char *devstr;

                     virCommandAddArg(cmd, "-device");
-                    if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps, NULL)))
+                    if (!(devstr = qemuBuildControllerDevStr(def, cont,
+                                                             qemuCaps, NULL)))
                         goto error;

                     virCommandAddArg(cmd, devstr);
                     VIR_FREE(devstr);
                 }
-            } else if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
-                def->controllers[i]->model == -1 &&
-                !qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
+            } else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
+                       cont->model == -1 &&
+                       !qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
                 if (usblegacy) {
                     qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                                    _("Multiple legacy USB controller not supported"));
+                                    _("Multiple legacy USB controllers are "
+                                      "not supported"));
                     goto error;
                 }
                 usblegacy = true;
@@ -4814,7 +4817,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                 virCommandAddArg(cmd, "-device");

                 char *devstr;
-                if (!(devstr = qemuBuildControllerDevStr(def, def->controllers[i], qemuCaps,
+                if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps,
                                                          &usbcontroller)))
                     goto error;

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index dc04d13..5e831b7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5797,8 +5797,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
             flags |= VIR_DOMAIN_AFFECT_CONFIG;
         /* check consistency between flags and the vm state */
         if (flags & VIR_DOMAIN_AFFECT_LIVE) {
-            qemuReportError(VIR_ERR_OPERATION_INVALID,
-                            "%s",
+            qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
                             _("cannot do live update a device on "
                               "inactive domain"));
             goto endjob;
@@ -5806,8 +5805,8 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
     }

     if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && !vm->persistent) {
-         qemuReportError(VIR_ERR_OPERATION_INVALID,
-                         "%s", _("cannot modify device on transient domain"));
+         qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                         _("cannot modify device on transient domain"));
          goto endjob;
     }

-- 
1.7.8.6

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