]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: delete useless primaryVideo variable
authorJán Tomko <jtomko@redhat.com>
Mon, 11 Apr 2016 13:20:41 +0000 (15:20 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 12 Apr 2016 08:45:35 +0000 (10:45 +0200)
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

index d6d4334247ad3d8c870a3a14f43386b5c939371d..d7dcc4cb6dadc9b203268a4c11bfed4e7d889a4c 100644 (file)
@@ -15088,7 +15088,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) {
@@ -16427,7 +16426,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"));
@@ -16435,7 +16434,6 @@ virDomainDefParseXML(xmlDocPtr xml,
             }
 
             insertAt = 0;
-            primaryVideo = true;
         }
         if (VIR_INSERT_ELEMENT_INPLACE(def->videos,
                                        insertAt,