[PATCH 3/7] conf: use the iterator directly when parsing video devices

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

 



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 | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index adcc439..fe87168 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16420,10 +16420,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) {
-- 
2.7.3

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