[libvirt PATCH 08/10] virDomainVideoResolutionDefParseXML: Use virXMLProp*

Tim Wiederhake twiederh at redhat.com
Wed Apr 21 13:33:30 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/conf/domain_conf.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ec7d48b40e..9e968c087d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14914,31 +14914,14 @@ static virDomainVideoResolutionDef *
 virDomainVideoResolutionDefParseXML(xmlNodePtr node)
 {
     g_autofree virDomainVideoResolutionDef *def = NULL;
-    g_autofree char *x = NULL;
-    g_autofree char *y = NULL;
-
-    x = virXMLPropString(node, "x");
-    y = virXMLPropString(node, "y");
-
-    if (!x || !y) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("missing values for resolution"));
-        return NULL;
-    }
 
     def = g_new0(virDomainVideoResolutionDef, 1);
 
-    if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("cannot parse video x-resolution '%s'"), x);
+    if (virXMLPropUInt(node, "x", 10, VIR_XML_PROP_REQUIRED, &def->x) < 0)
         return NULL;
-    }
 
-    if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("cannot parse video y-resolution '%s'"), y);
+    if (virXMLPropUInt(node, "y", 10, VIR_XML_PROP_REQUIRED, &def->y) < 0)
         return NULL;
-    }
 
     return g_steal_pointer(&def);
 }
-- 
2.26.3




More information about the libvir-list mailing list