[libvirt PATCH 04/10] virDomainGraphicsDefParseXML: Use virXMLProp*

Tim Wiederhake posted 10 patches 1 month, 3 weeks ago

[libvirt PATCH 04/10] virDomainGraphicsDefParseXML: Use virXMLProp*

Posted by Tim Wiederhake 1 month, 3 weeks ago
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 src/conf/domain_conf.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9aba2edf0a..f599d1afe7 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13097,25 +13097,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:
-- 
2.26.3