[PATCH 25/43] virQEMUCapsLoadCache: Use 'virXMLPropUInt' instead of 'virXPathULong'

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

 



The libvirt version is stored in an 'unsigned int' use the proper XPath
query function for the type and remove the temporary variable.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index dd50f85c73..63590f139f 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4385,7 +4385,6 @@ virQEMUCapsLoadCache(virArch hostArch,
     g_autoptr(xmlDoc) doc = NULL;
     g_autoptr(xmlXPathContext) ctxt = NULL;
     long long int l;
-    unsigned long lu;

     if (!(doc = virXMLParse(filename, NULL, NULL, "qemuCaps", &ctxt, NULL, false)))
         return -1;
@@ -4397,9 +4396,9 @@ virQEMUCapsLoadCache(virArch hostArch,
     }
     qemuCaps->libvirtCtime = (time_t)l;

-    qemuCaps->libvirtVersion = 0;
-    if (virXPathULong("string(./selfvers)", ctxt, &lu) == 0)
-        qemuCaps->libvirtVersion = lu;
+    if (virXMLPropUInt(ctxt->node, "selfvers", 10, VIR_XML_PROP_NONE,
+                       &qemuCaps->libvirtVersion) < 0)
+        return -1;

     if (!skipInvalidation &&
         (qemuCaps->libvirtCtime != virGetSelfLastChanged() ||
-- 
2.37.3




[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