fixed a bug when size of xmlXPathContext changes, uses the libxml2 alloc
authorDaniel Veillard <veillard@src.gnome.org>
Sun, 7 Aug 2005 14:06:21 +0000 (14:06 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Sun, 7 Aug 2005 14:06:21 +0000 (14:06 +0000)
* libxslt/xsltutils.c: fixed a bug when size of xmlXPathContext
  changes, uses the libxml2 alloc and dealloc functions instead.
Daniel

ChangeLog
libxslt/xsltutils.c

index 10e116c..469ed08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Aug  7 16:04:47 CEST 2005 Daniel Veillard <daniel@veillard.com>
+
+       * libxslt/xsltutils.c: fixed a bug when size of xmlXPathContext
+         changes, uses the libxml2 alloc and dealloc functions instead.
+
 Tue Jul 13 22:41:03 PDT 2005 William Brack <wbrack@mmm.com.hk>
 
        * libxslt/transform.c: added check in xsltCopyText to assure
index 6464e24..ccfe282 100644 (file)
@@ -1921,13 +1921,18 @@ xsltGetProfileInformation(xsltTransformContextPtr ctxt)
  */
 xmlXPathCompExprPtr
 xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) {
-    xmlXPathContext xctxt;
+    xmlXPathContextPtr xctxt;
     xmlXPathCompExprPtr ret;
 
-    memset(&xctxt, 0, sizeof(xctxt));
     if (style != NULL)
-       xctxt.dict = style->dict;
-    ret = xmlXPathCtxtCompile(&xctxt, str);
+       xctxt = xmlXPathNewContext(style->doc);
+    else
+       xctxt = xmlXPathNewContext(NULL);
+    memset(xctxt, 0, sizeof(xctxt));
+    if (style != NULL)
+       xctxt->dict = style->dict;
+    ret = xmlXPathCtxtCompile(xctxt, str);
+    xmlXPathFreeContext(xctxt);
     /*
      * TODO: there is a lot of optimizations which should be possible
      *       like variable slot precomputations, function precomputations, etc.