[libvirt] [PATCH 4/7] conf: use insertAt instead of j

Ján Tomko jtomko at redhat.com
Mon Apr 11 13:38:21 UTC 2016


We call VIR_INSERT_ELEMENT_INPLACE either with 0 (for primary video)
or def->nvideos (for the rest).

Use a variable with more semantic name, since j is usually used
for iterating.
---
 src/conf/domain_conf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fe87168..e9b1e21 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16419,8 +16419,8 @@ virDomainDefParseXML(xmlDocPtr xml,
     if (n && VIR_ALLOC_N(def->videos, n) < 0)
         goto error;
     for (i = 0; i < n; i++) {
-        j = def->nvideos;
         virDomainVideoDefPtr video;
+        ssize_t insertAt = -1;
 
         if (!(video = virDomainVideoDefParseXML(nodes[i], def, flags)))
             goto error;
@@ -16433,11 +16433,11 @@ virDomainDefParseXML(xmlDocPtr xml,
                 goto error;
             }
 
-            j = 0;
+            insertAt = 0;
             primaryVideo = true;
         }
         if (VIR_INSERT_ELEMENT_INPLACE(def->videos,
-                                       j,
+                                       insertAt,
                                        def->nvideos,
                                        video) < 0) {
             virDomainVideoDefFree(video);
-- 
2.7.3




More information about the libvir-list mailing list