[libxslt] Reuse XPath context in dyn:map
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxslt] Reuse XPath context in dyn:map
- Date: Mon, 22 Apr 2019 16:01:29 +0000 (UTC)
commit 41d33534e84feddb2263ed02ea7f2563a5f6e916
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Sat Apr 20 15:35:05 2019 +0200
Reuse XPath context in dyn:map
Compile XPath expression using the current context to propagate
information like maxParserDepth and in-scope namespaces.
libexslt/dynamic.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/libexslt/dynamic.c b/libexslt/dynamic.c
index a5b569af..a8cc72d9 100644
--- a/libexslt/dynamic.c
+++ b/libexslt/dynamic.c
@@ -127,7 +127,15 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs)
goto cleanup;
}
- if (str == NULL || !xmlStrlen(str) || !(comp = xmlXPathCompile(str)))
+ tctxt = xsltXPathGetTransformContext(ctxt);
+ if (tctxt == NULL) {
+ xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+ "dyn:map : internal error tctxt == NULL\n");
+ goto cleanup;
+ }
+
+ if (str == NULL || !xmlStrlen(str) ||
+ !(comp = xmlXPathCtxtCompile(tctxt->xpathCtxt, str)))
goto cleanup;
oldDoc = ctxt->context->doc;
@@ -139,12 +147,6 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs)
* since we really don't know we're going to be adding node(s)
* down the road we create the RVT regardless
*/
- tctxt = xsltXPathGetTransformContext(ctxt);
- if (tctxt == NULL) {
- xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
- "dyn:map : internal error tctxt == NULL\n");
- goto cleanup;
- }
container = xsltCreateRVT(tctxt);
if (container == NULL) {
xsltTransformError(tctxt, NULL, NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]