[PATCH 20/20] virDomainDiskSourceNVMeParse: Use virXMLPropULongLong()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Inside of virDomainDiskSourceNVMeParse() we have
virXMLPropString() + virStrToLong_ull() combo. Switch to
virXMLPropULongLong() which does the same thing.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 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;
     }
 
-- 
2.41.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux