]> xenbits.xensource.com Git - libvirt.git/commitdiff
virDomainGraphicsDefParseXML: Use virXMLProp*
authorTim Wiederhake <twiederh@redhat.com>
Fri, 23 Apr 2021 15:39:17 +0000 (17:39 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 26 Apr 2021 11:43:32 +0000 (13:43 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/domain_conf.c

index d57450b3c0c83e749bfcdbfa68bdc0a0b6168d63..5cadbacea6ea55bad045b2150eb00aa6d22734da 100644 (file)
@@ -13230,25 +13230,13 @@ virDomainGraphicsDefParseXML(virDomainXMLOption *xmlopt,
                              unsigned int flags)
 {
     virDomainGraphicsDef *def;
-    int typeVal;
-    g_autofree char *type = NULL;
 
     if (!(def = virDomainGraphicsDefNew(xmlopt)))
         return NULL;
 
-    type = virXMLPropString(node, "type");
-    if (!type) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("missing graphics device type"));
-        goto error;
-    }
-
-    if ((typeVal = virDomainGraphicsTypeFromString(type)) < 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("unknown graphics device type '%s'"), type);
+    if (virXMLPropEnum(node, "type", virDomainGraphicsTypeFromString,
+                       VIR_XML_PROP_REQUIRED, &def->type) < 0)
         goto error;
-    }
-    def->type = typeVal;
 
     switch (def->type) {
     case VIR_DOMAIN_GRAPHICS_TYPE_VNC: