[PATCH 01/43] util: xml: Remove unused virXPathNumber

Peter Krempa pkrempa at redhat.com
Mon Oct 24 14:14:06 UTC 2022


'virXPathNumber' is not used currently, remove it.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/libvirt_private.syms |  1 -
 src/util/virxml.c        | 33 ---------------------------------
 src/util/virxml.h        |  4 ----
 3 files changed, 38 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0b0ccbafe5..61003eff39 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3699,7 +3699,6 @@ virXPathLongHex;
 virXPathLongLong;
 virXPathNode;
 virXPathNodeSet;
-virXPathNumber;
 virXPathString;
 virXPathUInt;
 virXPathULong;
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 0548a29e65..d99b060b63 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -90,39 +90,6 @@ virXPathString(const char *xpath,
 }


-/**
- * virXPathNumber:
- * @xpath: the XPath string to evaluate
- * @ctxt: an XPath context
- * @value: the returned double value
- *
- * Convenience function to evaluate an XPath number
- *
- * Returns 0 in case of success in which case @value is set,
- *         or -1 if the evaluation failed.
- */
-int
-virXPathNumber(const char *xpath,
-               xmlXPathContextPtr ctxt,
-               double *value)
-{
-    g_autoptr(xmlXPathObject) obj = NULL;
-
-    if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("Invalid parameter to virXPathNumber()"));
-        return -1;
-    }
-    obj = xmlXPathEval(BAD_CAST xpath, ctxt);
-    if ((obj == NULL) || (obj->type != XPATH_NUMBER) ||
-        (isnan(obj->floatval))) {
-        return -1;
-    }
-
-    *value = obj->floatval;
-    return 0;
-}
-
 static int
 virXPathLongBase(const char *xpath,
                  xmlXPathContextPtr ctxt,
diff --git a/src/util/virxml.h b/src/util/virxml.h
index febc7cbdfb..6d61d91497 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -51,10 +51,6 @@ char *
 virXPathString(const char *xpath,
                xmlXPathContextPtr ctxt);
 int
-virXPathNumber(const char *xpath,
-               xmlXPathContextPtr ctxt,
-               double *value);
-int
 virXPathInt(const char *xpath,
             xmlXPathContextPtr ctxt,
             int *value);
-- 
2.37.3



More information about the libvir-list mailing list