]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: explicitly set VIR_DOMAIN_VIDEO_TYPE_DEFAULT to 0
authorJonathon Jongsma <jjongsma@redhat.com>
Mon, 7 Nov 2022 15:34:55 +0000 (09:34 -0600)
committerJonathon Jongsma <jjongsma@redhat.com>
Wed, 8 Mar 2023 19:05:05 +0000 (13:05 -0600)
Ensure that new virDomainVideoDef objects have their 'type' set to
VIR_DOMAIN_VIDEO_TYPE_DEFAULT and remove places that this value is set
after construction. Since virDomainVideoDefNew() uses g_new0() allocate
the instance, all fields are initialized to 0.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_conf.c
src/conf/domain_conf.h

index f7f9ec3c0a40b254cf7706d89103848fc3c42a45..53b3a1139c1491d6d97e35752847d9d9985af7cc 100644 (file)
@@ -12910,8 +12910,6 @@ virDomainVideoDefParseXML(virDomainXMLOption *xmlopt,
                            _("unknown video model '%s'"), type);
             return NULL;
         }
-    } else {
-        def->type = VIR_DOMAIN_VIDEO_TYPE_DEFAULT;
     }
 
     if ((ram = virXPathString("string(./model/@ram)", ctxt))) {
@@ -21833,7 +21831,6 @@ virDomainDefAddImplicitVideo(virDomainDef *def, virDomainXMLOption *xmlopt)
 
     if (!(video = virDomainVideoDefNew(xmlopt)))
         return -1;
-    video->type = VIR_DOMAIN_VIDEO_TYPE_DEFAULT;
     VIR_APPEND_ELEMENT(def->videos, def->nvideos, video);
 
     return 0;
index 21ea4a48b3470dadcd11cd4854daf9976bbc9650..bacadb5ae09e7ee6cc86e658da1c8868e6c95d13 100644 (file)
@@ -1768,7 +1768,7 @@ typedef enum {
 
 
 typedef enum {
-    VIR_DOMAIN_VIDEO_TYPE_DEFAULT,
+    VIR_DOMAIN_VIDEO_TYPE_DEFAULT = 0,
     VIR_DOMAIN_VIDEO_TYPE_VGA,
     VIR_DOMAIN_VIDEO_TYPE_CIRRUS,
     VIR_DOMAIN_VIDEO_TYPE_VMVGA,