[libvirt] [PATCH 5/7] conf: delete useless primaryVideo variable

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


If we encounter a video device with primary=yes, we insert it
at def->videos[0].

There is no need to record this in a separate variable,
just check if there already is a primary video at def->videos[0].
---
 src/conf/domain_conf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e9b1e21..1788c91 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15087,7 +15087,6 @@ virDomainDefParseXML(xmlDocPtr xml,
     bool usb_none = false;
     bool usb_other = false;
     bool usb_master = false;
-    bool primaryVideo = false;
     char *netprefix = NULL;
 
     if (flags & VIR_DOMAIN_DEF_PARSE_VALIDATE) {
@@ -16426,7 +16425,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             goto error;
 
         if (video->primary) {
-            if (primaryVideo) {
+            if (def->nvideos != 0 && def->videos[0]->primary) {
                 virDomainVideoDefFree(video);
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("Only one primary video device is supported"));
@@ -16434,7 +16433,6 @@ virDomainDefParseXML(xmlDocPtr xml,
             }
 
             insertAt = 0;
-            primaryVideo = true;
         }
         if (VIR_INSERT_ELEMENT_INPLACE(def->videos,
                                        insertAt,
-- 
2.7.3




More information about the libvir-list mailing list