Re: [PATCH 1/6] maint: Clean up coding style

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

 



On 2012年07月10日 01:29, Peter Krempa wrote:
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 3fb90db..17b0e0e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8602,11 +8602,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],
@@ -8622,11 +8623,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);
@@ -8748,9 +8750,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;

@@ -9044,8 +9046,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) {
@@ -9064,8 +9066,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 94b2919..44c7c8b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4678,25 +4678,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)) {


Oh, not only about the coding style. But it's the right fix. ACK.

Osier

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