[PATCH 04/18] conf: eliminate monster condition in virDomainControllerDefFormat

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

 



Move most of the subelement formatting out of the giant if.
---
 src/conf/domain_conf.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 57f52be..81385d6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -21460,11 +21460,7 @@ virDomainControllerDefFormat(virBufferPtr buf,
         break;
     }
 
-    if (pciModel || pciTarget ||
-        def->queues || def->cmd_per_lun || def->max_sectors || def->ioeventfd ||
-        def->iothread ||
-        virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) {
-
+    if (pciModel || pciTarget) {
         if (pciModel) {
             modelName = virDomainControllerPCIModelNameTypeToString(def->opts.pciopts.modelName);
             if (!modelName) {
@@ -21501,17 +21497,17 @@ virDomainControllerDefFormat(virBufferPtr buf,
                 virBufferAddLit(&childBuf, "</target>\n");
             }
         }
+    }
 
-        virDomainControllerDriverFormat(&childBuf, def);
+    virDomainControllerDriverFormat(&childBuf, def);
 
-        if (virDomainDeviceInfoNeedsFormat(&def->info, flags) &&
-            virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0)
-            return -1;
+    if (virDomainDeviceInfoNeedsFormat(&def->info, flags) &&
+        virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0)
+        return -1;
 
-        if (pcihole64) {
-            virBufferAsprintf(&childBuf, "<pcihole64 unit='KiB'>%lu</"
-                              "pcihole64>\n", def->opts.pciopts.pcihole64size);
-        }
+    if (pcihole64) {
+        virBufferAsprintf(&childBuf, "<pcihole64 unit='KiB'>%lu</"
+                          "pcihole64>\n", def->opts.pciopts.pcihole64size);
     }
 
     if (virBufferUse(&childBuf)) {
-- 
2.10.2

--
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]
  Powered by Linux