diff mbox

[03/10] conf: disk: Remove one unnecessary level of indentation

Message ID 570D02F4.9000807@redhat.com
State New
Headers show

Commit Message

Cole Robinson April 12, 2016, 2:15 p.m. UTC
On 04/12/2016 09:55 AM, Peter Krempa wrote:
> Also simplify the code by switching to a for loop.

> ---

>  src/conf/domain_conf.c | 737 ++++++++++++++++++++++++-------------------------

>  1 file changed, 368 insertions(+), 369 deletions(-)

> 


git show -w makes it clear:


ACK

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fb5d327..f691174 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6760,9 +6760,10 @@  virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     rawio = virXMLPropString(node, "rawio");
     sgio = virXMLPropString(node, "sgio");

-    cur = node->children;
-    while (cur != NULL) {
-        if (cur->type == XML_ELEMENT_NODE) {
+    for (cur = node->children; cur != NULL; cur = cur->next) {
+        if (cur->type != XML_ELEMENT_NODE)
+            continue;
+
         if (!source && xmlStrEqual(cur->name, BAD_CAST "source")) {
             sourceNode = cur;

@@ -7176,8 +7177,6 @@  virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
             /* boot is parsed as part of virDomainDeviceInfoParseXML */
         }
     }
-        cur = cur->next;
-    }

     /* Disk volume types will have authentication information handled in
      * virStorageTranslateDiskSourcePool