]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virQEMUCapsLoadCache: Use 'virXMLPropUInt' instead of 'virXPathULong'
authorPeter Krempa <pkrempa@redhat.com>
Wed, 5 Oct 2022 12:16:46 +0000 (14:16 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 2 Nov 2022 08:20:57 +0000 (09:20 +0100)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_capabilities.c

index dd50f85c73ae78fa3191c1ccf4075b81242a9d33..63590f139f0fe41ff928cc2438dbd97b77773d4c 100644 (file)
@@ -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() ||