[libxml2] Make xmlXPathEvalExpression call xmlXPathEval



commit 640a368c804d0eb5f3a74b8dcf246e8abd352fdd
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sat May 27 14:59:49 2017 +0200

    Make xmlXPathEvalExpression call xmlXPathEval
    
    Both functions are supposed to do exactly the same.

 xpath.c |   39 ++-------------------------------------
 1 files changed, 2 insertions(+), 37 deletions(-)
---
diff --git a/xpath.c b/xpath.c
index 22cfdc0..9440af1 100644
--- a/xpath.c
+++ b/xpath.c
@@ -15190,46 +15190,11 @@ xmlXPathNodeEval(xmlNodePtr node, const xmlChar *str, xmlXPathContextPtr ctx) {
  * @str:  the XPath expression
  * @ctxt:  the XPath context
  *
- * Evaluate the XPath expression in the given context.
- *
- * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL.
- *         the caller has to free the object.
+ * Alias for xmlXPathEval.
  */
 xmlXPathObjectPtr
 xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) {
-    xmlXPathParserContextPtr pctxt;
-    xmlXPathObjectPtr res, tmp;
-    int stack = 0;
-
-    CHECK_CTXT(ctxt)
-
-    xmlXPathInit();
-
-    pctxt = xmlXPathNewParserContext(str, ctxt);
-    if (pctxt == NULL)
-        return NULL;
-    xmlXPathEvalExpr(pctxt);
-
-    if ((*pctxt->cur != 0) || (pctxt->error != XPATH_EXPRESSION_OK)) {
-       xmlXPatherror(pctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR);
-       res = NULL;
-    } else {
-       res = valuePop(pctxt);
-    }
-    do {
-        tmp = valuePop(pctxt);
-       if (tmp != NULL) {
-           xmlXPathReleaseObject(ctxt, tmp);
-           stack++;
-       }
-    } while (tmp != NULL);
-    if ((stack != 0) && (res != NULL)) {
-       xmlGenericError(xmlGenericErrorContext,
-               "xmlXPathEvalExpression: %d object left on the stack\n",
-               stack);
-    }
-    xmlXPathFreeParserContext(pctxt);
-    return(res);
+    return(xmlXPathEval(str, ctxt));
 }
 
 /************************************************************************


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