10 more minutes waiting for doctor appointment:
authorDaniel Veillard <veillard@src.gnome.org>
Mon, 5 Mar 2001 09:53:27 +0000 (09:53 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Mon, 5 Mar 2001 09:53:27 +0000 (09:53 +0000)
- libxslt/pattern.[ch] libxslt/transform.c: added
  xsltCleanupTemplates() to clean up state left after processing.
Daniel

ChangeLog
configure.in
libxslt/pattern.c
libxslt/pattern.h
libxslt/transform.c

index 59195a7..eeb9a73 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Mar  5 21:51:54 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+       * libxslt/pattern.[ch] libxslt/transform.c: added 
+         xsltCleanupTemplates() to clean up state left after processing.
+
 Sun Mar  4 19:03:27 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
 
        * libxslt/transform.c: applied patch from William M. Brack
index 8bab2d6..3406c9b 100644 (file)
@@ -95,7 +95,7 @@ dnl
 dnl find libxml
 dnl
 XML_CONFIG="xml2-config"
-AC_MSG_CHECKING(for libxml libraries >= 2.3.3
+AC_MSG_CHECKING(for libxml libraries >= 2.3.2
 if test "x$LIBXML_PREFIX" != "x"
 then
        if ${LIBXML_PREFIX}/bin/xml2-config --libs print > /dev/null 2>&1
@@ -112,13 +112,13 @@ dnl
 if test "x$XML_CONFIG" != "x"
 then
        vers=`$XML_CONFIG --version | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
-       if test "$vers" -ge 2003003
+       if test "$vers" -ge 2003002
        then
                LIBXML_LIBS="`$XML_CONFIG --libs`"
                LIBXML_CFLAGS="`$XML_CONFIG --cflags`"
                AC_MSG_RESULT(found)
        else
-               AC_MSG_ERROR(You need at least libxml 2.3.3 for this version of libxslt)
+               AC_MSG_ERROR(You need at least libxml 2.3.2 for this version of libxslt)
        fi
 else
        AC_MSG_ERROR(Could not find libxml2 anywhere, check ftp://xmlsoft.org/.)
index 31f5a19..787db93 100644 (file)
@@ -289,6 +289,21 @@ xsltReverseCompMatch(xsltCompMatchPtr comp) {
     comp->steps[comp->nbStep++].op = XSLT_OP_END;
 }
 
+/**
+ * xsltCleanupCompMatch:
+ * @comp:  the compiled match expression
+ *
+ * remove all computation state from the pattern
+ */
+void
+xsltCleanupCompMatch(xsltCompMatchPtr comp) {
+    int i;
+    
+    for (i = 0;i < comp->nbStep;i++) {
+       comp->steps[i].previous = NULL;
+    }
+}
+
 /************************************************************************
  *                                                                     *
  *             The interpreter for the precompiled patterns            *
@@ -1755,6 +1770,22 @@ xsltGetTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
     return(NULL);
 }
 
+/**
+ * xsltCleanupTemplates:
+ * @style: an XSLT stylesheet
+ *
+ * Cleanup the state of the templates used by the stylesheet and
+ * the ones it imports.
+ */
+void
+xsltCleanupTemplates(xsltStylesheetPtr style) {
+    while (style != NULL) {
+       xmlHashScan((xmlHashTablePtr) style->templatesHash,
+                   (xmlHashScanner) xsltCleanupCompMatch, NULL);
+
+       style = xsltNextImport(style);
+    }
+}
 
 /**
  * xsltFreeTemplateHashes:
index 00b944b..71fa0ba 100644 (file)
@@ -44,6 +44,8 @@ xsltTemplatePtr       xsltGetTemplate         (xsltTransformContextPtr ctxt,
                                         xmlNodePtr node,
                                         xsltStylesheetPtr style);
 void           xsltFreeTemplateHashes  (xsltStylesheetPtr style);
+void           xsltCleanupTemplates    (xsltStylesheetPtr style);
+
 #if 0
 int            xsltMatchPattern        (xsltTransformContextPtr ctxt,
                                         xmlNodePtr node,
index 1d20bc2..196e722 100644 (file)
@@ -2568,6 +2568,7 @@ xsltApplyStylesheet(xsltStylesheetPtr style, xmlDocPtr doc) {
     varsPush(ctxt, NULL);
     xsltProcessOneNode(ctxt, ctxt->node);
     xsltFreeStackElemList(varsPop(ctxt));
+    xsltCleanupTemplates(style);
 
 
     if ((ctxt->type = XSLT_OUTPUT_XML) &&