[libvirt PATCH 05/10] virDomainDeviceDimmAddressParseXML: Use virXMLProp*

Tim Wiederhake twiederh at redhat.com
Wed Apr 21 15:51:28 UTC 2021


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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cc0bdeed56..c1ed206119 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6508,24 +6508,13 @@ static int
 virDomainDeviceDimmAddressParseXML(xmlNodePtr node,
                                    virDomainDeviceDimmAddress *addr)
 {
-    g_autofree char *tmp = NULL;
-
-    if (!(tmp = virXMLPropString(node, "slot")) ||
-        virStrToLong_uip(tmp, NULL, 10, &addr->slot) < 0) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       _("invalid or missing dimm slot id '%s'"),
-                       NULLSTR(tmp));
+    if (virXMLPropUInt(node, "slot", 10, VIR_XML_PROP_REQUIRED,
+                       &addr->slot) < 0)
         return -1;
-    }
-    VIR_FREE(tmp);
 
-    if ((tmp = virXMLPropString(node, "base"))) {
-        if (virStrToLong_ullp(tmp, NULL, 16, &addr->base) < 0) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           _("invalid dimm base address '%s'"), tmp);
-            return -1;
-        }
-    }
+    if (virXMLPropULongLong(node, "base", 16, VIR_XML_PROP_NONE,
+                            &addr->base) < 0)
+        return -1;
 
     return 0;
 }
-- 
2.26.3




More information about the libvir-list mailing list