]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: use the iterator directly when parsing video devices
authorJán Tomko <jtomko@redhat.com>
Mon, 11 Apr 2016 12:43:43 +0000 (14:43 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 12 Apr 2016 08:45:35 +0000 (10:45 +0200)
We start with both i and def->nvideos at 0 and increment both
after every successful iteration.

Use i directly, instead of passing the def->nvideos value through j.

src/conf/domain_conf.c

index 31577ae370ed555a998293d4b1520e7502b46732..690287d879ce8fea65486bfc4965947d6ede21d2 100644 (file)
@@ -16421,10 +16421,9 @@ virDomainDefParseXML(xmlDocPtr xml,
         goto error;
     for (i = 0; i < n; i++) {
         j = def->nvideos;
-        virDomainVideoDefPtr video = virDomainVideoDefParseXML(nodes[j],
-                                                               def,
-                                                               flags);
-        if (!video)
+        virDomainVideoDefPtr video;
+
+        if (!(video = virDomainVideoDefParseXML(nodes[i], def, flags)))
             goto error;
 
         if (video->primary) {