[libxslt] Always reuse XPath context



commit 29414ac96203af9982d7f65cf5385224b6d675f4
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Mon May 13 10:38:49 2019 +0200

    Always reuse XPath context
    
    Fix remaining calls to xmlXPathCompile without an existing XPath
    context.

 libexslt/functions.c | 2 +-
 libxslt/templates.c  | 2 +-
 libxslt/transform.c  | 2 +-
 libxslt/variables.c  | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/libexslt/functions.c b/libexslt/functions.c
index 41d37493..2f744311 100644
--- a/libexslt/functions.c
+++ b/libexslt/functions.c
@@ -674,7 +674,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
      */
     sel = xmlGetNsProp(inst, (const xmlChar *) "select", NULL);
     if (sel != NULL) {
-       ret->select = xmlXPathCompile (sel);
+       ret->select = xsltXPathCompileFlags(style, sel, 0);
        xmlFree(sel);
     }
     /*
diff --git a/libxslt/templates.c b/libxslt/templates.c
index 88547ed8..48b73a53 100644
--- a/libxslt/templates.c
+++ b/libxslt/templates.c
@@ -332,7 +332,7 @@ xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
                        nsNr = i;
                    }
                }
-               comp = xmlXPathCompile(expr);
+               comp = xmlXPathCtxtCompile(ctxt->xpathCtxt, expr);
                 val = xsltEvalXPathStringNs(ctxt, comp, nsNr, nsList);
                xmlXPathFreeCompExpr(comp);
                xmlFree(expr);
diff --git a/libxslt/transform.c b/libxslt/transform.c
index b8dc363c..95ebd073 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -3462,7 +3462,7 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
                 * XPath expression.
                 * (see http://xml.apache.org/xalan-j/extensionslib.html#redirect)
                 */
-               cmp = xmlXPathCompile(URL);
+               cmp = xmlXPathCtxtCompile(ctxt->xpathCtxt, URL);
                 val = xsltEvalXPathString(ctxt, cmp);
                xmlXPathFreeCompExpr(cmp);
                xmlFree(URL);
diff --git a/libxslt/variables.c b/libxslt/variables.c
index 2982f092..019486e7 100644
--- a/libxslt/variables.c
+++ b/libxslt/variables.c
@@ -860,7 +860,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
        if ((comp != NULL) && (comp->comp != NULL)) {
            xpExpr = comp->comp;
        } else {
-           xpExpr = xmlXPathCompile(variable->select);
+           xpExpr = xmlXPathCtxtCompile(ctxt->xpathCtxt, variable->select);
        }
        if (xpExpr == NULL)
            return(NULL);
@@ -1101,7 +1101,7 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
        if ((comp != NULL) && (comp->comp != NULL)) {
            xpExpr = comp->comp;
        } else {
-           xpExpr = xmlXPathCompile(elem->select);
+           xpExpr = xmlXPathCtxtCompile(ctxt->xpathCtxt, elem->select);
        }
        if (xpExpr == NULL)
            goto error;
@@ -1552,7 +1552,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt,
 
     result = NULL;
     if (eval != 0) {
-        xpExpr = xmlXPathCompile(value);
+        xpExpr = xmlXPathCtxtCompile(ctxt->xpathCtxt, value);
        if (xpExpr != NULL) {
            xmlDocPtr oldXPDoc;
            xmlNodePtr oldXPContextNode;


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