From patchwork Tue Apr 12 14:15:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 65632 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1948264qge; Tue, 12 Apr 2016 07:18:05 -0700 (PDT) X-Received: by 10.28.109.129 with SMTP id b1mr26113308wmi.36.1460470685438; Tue, 12 Apr 2016 07:18:05 -0700 (PDT) Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com. [209.132.183.25]) by mx.google.com with ESMTPS id ur8si34529169wjc.174.2016.04.12.07.18.04 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Apr 2016 07:18:05 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u3CEFImu025272; Tue, 12 Apr 2016 10:15:18 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u3CEFHHh009822 for ; Tue, 12 Apr 2016 10:15:17 -0400 Received: from [10.3.113.40] (ovpn-113-40.phx2.redhat.com [10.3.113.40]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3CEFGfc031867; Tue, 12 Apr 2016 10:15:17 -0400 To: Peter Krempa , libvir-list@redhat.com References: <2a3beb3c3b418af34701d49e661e67f5cd4ec020.1460469219.git.pkrempa@redhat.com> From: Cole Robinson Message-ID: <570D02F4.9000807@redhat.com> Date: Tue, 12 Apr 2016 10:15:16 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <2a3beb3c3b418af34701d49e661e67f5cd4ec020.1460469219.git.pkrempa@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: Re: [libvirt] [PATCH 03/10] conf: disk: Remove one unnecessary level of indentation X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com 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 --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