]> xenbits.xensource.com Git - libvirt.git/commitdiff
virDomainIOThreadIDDefParseXML: Use virXMLProp*
authorTim Wiederhake <twiederh@redhat.com>
Fri, 16 Apr 2021 09:41:51 +0000 (11:41 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 16 Apr 2021 11:22:35 +0000 (13:22 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/domain_conf.c

index a0fb7731d9f4ad238f84a3832080c6d8ec9259ae..858ef5db9d27580bda33ee87277e7d7a112007cd 100644 (file)
@@ -18229,21 +18229,13 @@ static virDomainIOThreadIDDef *
 virDomainIOThreadIDDefParseXML(xmlNodePtr node)
 {
     virDomainIOThreadIDDef *iothrid;
-    g_autofree char *tmp = NULL;
 
     iothrid = g_new0(virDomainIOThreadIDDef, 1);
 
-    if (!(tmp = virXMLPropString(node, "id"))) {
-        virReportError(VIR_ERR_XML_ERROR, "%s",
-                       _("Missing 'id' attribute in <iothread> element"));
-        goto error;
-    }
-    if (virStrToLong_uip(tmp, NULL, 10, &iothrid->iothread_id) < 0 ||
-        iothrid->iothread_id == 0) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       _("invalid iothread 'id' value '%s'"), tmp);
+    if (virXMLPropUInt(node, "id", 10,
+                       VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
+                       &iothrid->iothread_id) < 0)
         goto error;
-    }
 
     return iothrid;