]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainDeviceDimmAddressParseXML: Use virXMLProp*
authorTim Wiederhake <twiederh@redhat.com>
Wed, 21 Apr 2021 15:51:28 +0000 (17:51 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 22 Apr 2021 09:24:53 +0000 (11:24 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/domain_conf.c

index aa3a109a3248a53cdf971e0a3ed5640b6d73581b..aef63464f03c05eb3c8ebe2d89d675dca6efd1a0 100644 (file)
@@ -6515,24 +6515,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;
 }