From 5bddeb8e37a3047c8f6fadefe89510f57034ebd9 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Thu, 14 Sep 2023 15:53:12 +0200 Subject: [PATCH] virDomainDiskSourceNVMeParse: Use virXMLPropULongLong() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/conf/domain_conf.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) 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; }