From: Michal Privoznik Date: Thu, 14 Sep 2023 13:53:12 +0000 (+0200) Subject: virDomainDiskSourceNVMeParse: Use virXMLPropULongLong() X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5bddeb8e37a3047c8f6fadefe89510f57034ebd9;p=libvirt.git virDomainDiskSourceNVMeParse: Use virXMLPropULongLong() Inside of virDomainDiskSourceNVMeParse() we have virXMLPropString() + virStrToLong_ull() combo. Switch to virXMLPropULongLong() which does the same thing. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5f4146b4e3..0efac66f61 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7229,7 +7229,6 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node, { g_autoptr(virStorageSourceNVMeDef) nvme = NULL; g_autofree char *type = NULL; - g_autofree char *namespc = NULL; xmlNodePtr address; nvme = g_new0(virStorageSourceNVMeDef, 1); @@ -7247,16 +7246,9 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node, return -1; } - if (!(namespc = virXMLPropString(node, "namespace"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing 'namespace' attribute to disk source")); - return -1; - } - - if (virStrToLong_ull(namespc, NULL, 10, &nvme->namespc) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("malformed namespace '%1$s'"), - namespc); + if (virXMLPropULongLong(node, "namespace", 10, + VIR_XML_PROP_REQUIRED, + &nvme->namespc) < 0) { return -1; }