[PATCH 43/43] util: xml: Remove unused virXPathULong*

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


Remove the now-unused functions for parsing 'unsigned long' values via
XPath.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/libvirt_private.syms |  2 --
 src/util/virxml.c        | 75 ----------------------------------------
 src/util/virxml.h        |  8 -----
 3 files changed, 85 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0fc5481a26..5bc58d9281 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3699,8 +3699,6 @@ virXPathNodeSet;
 virXPathString;
 virXPathUInt;
 virXPathUIntBase;
-virXPathULong;
-virXPathULongHex;
 virXPathULongLong;
 virXPathULongLongBase;

diff --git a/src/util/virxml.c b/src/util/virxml.c
index f5ee9284a6..ca83ea1dd5 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -142,38 +142,6 @@ virXPathInt(const char *xpath,
 }


-static int
-virXPathULongBase(const char *xpath,
-                  xmlXPathContextPtr ctxt,
-                  int base,
-                  unsigned long *value)
-{
-    g_autoptr(xmlXPathObject) obj = NULL;
-    int ret = 0;
-
-    if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("Invalid parameter to virXPathULong()"));
-        return -1;
-    }
-    obj = xmlXPathEval(BAD_CAST xpath, ctxt);
-    if ((obj != NULL) && (obj->type == XPATH_STRING) &&
-        (obj->stringval != NULL) && (obj->stringval[0] != 0)) {
-        if (virStrToLong_ul((char *) obj->stringval, NULL, base, value) < 0)
-            ret = -2;
-    } else if ((obj != NULL) && (obj->type == XPATH_NUMBER) &&
-               (!(isnan(obj->floatval)))) {
-        *value = (unsigned long) obj->floatval;
-        if (*value != obj->floatval)
-            ret = -2;
-    } else {
-        ret = -1;
-    }
-
-    return ret;
-}
-
-
 /**
  * virXPathUIntBase:
  * @xpath: the XPath string to evaluate
@@ -216,49 +184,6 @@ virXPathUInt(const char *xpath,
 }


-/**
- * virXPathULong:
- * @xpath: the XPath string to evaluate
- * @ctxt: an XPath context
- * @value: the returned long value
- *
- * Convenience function to evaluate an XPath number
- *
- * Returns 0 in case of success in which case @value is set,
- *         or -1 if the XPath evaluation failed or -2 if the
- *         value doesn't have a long format.
- */
-int
-virXPathULong(const char *xpath,
-              xmlXPathContextPtr ctxt,
-              unsigned long *value)
-{
-    return virXPathULongBase(xpath, ctxt, 10, value);
-}
-
-
-/**
- * virXPathUHex:
- * @xpath: the XPath string to evaluate
- * @ctxt: an XPath context
- * @value: the returned long value
- *
- * Convenience function to evaluate an XPath number
- * according to base of 16
- *
- * Returns 0 in case of success in which case @value is set,
- *         or -1 if the XPath evaluation failed or -2 if the
- *         value doesn't have a long format.
- */
-int
-virXPathULongHex(const char *xpath,
-                 xmlXPathContextPtr ctxt,
-                 unsigned long *value)
-{
-    return virXPathULongBase(xpath, ctxt, 16, value);
-}
-
-
 /**
  * virXPathULongLongBase:
  * @xpath: the XPath string to evaluate
diff --git a/src/util/virxml.h b/src/util/virxml.h
index 439a2a9991..f19cbe59ae 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -60,10 +60,6 @@ virXPathUInt(const char *xpath,
              xmlXPathContextPtr ctxt,
              unsigned int *value);
 int
-virXPathULong(const char *xpath,
-              xmlXPathContextPtr ctxt,
-              unsigned long *value);
-int
 virXPathULongLongBase(const char *xpath,
                       xmlXPathContextPtr ctxt,
                       unsigned int base,
@@ -76,10 +72,6 @@ int
 virXPathLongLong(const char *xpath,
                  xmlXPathContextPtr ctxt,
                  long long *value);
-int
-virXPathULongHex(const char *xpath,
-                 xmlXPathContextPtr ctxt,
-                 unsigned long *value);
 xmlNodePtr
 virXPathNode(const char *xpath,
              xmlXPathContextPtr ctxt);
-- 
2.37.3



More information about the libvir-list mailing list