From: Daniel Veillard Date: Mon, 5 Mar 2001 09:53:27 +0000 (+0000) Subject: 10 more minutes waiting for doctor appointment: X-Git-Tag: v1.1.28~1424 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31330634f8df08248d1db7062820acf071bab09d;p=platform%2Fupstream%2Flibxslt.git 10 more minutes waiting for doctor appointment: - libxslt/pattern.[ch] libxslt/transform.c: added xsltCleanupTemplates() to clean up state left after processing. Daniel --- diff --git a/ChangeLog b/ChangeLog index 59195a7..eeb9a73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Mar 5 21:51:54 CET 2001 Daniel Veillard + + * 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 * libxslt/transform.c: applied patch from William M. Brack diff --git a/configure.in b/configure.in index 8bab2d6..3406c9b 100644 --- a/configure.in +++ b/configure.in @@ -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/.) diff --git a/libxslt/pattern.c b/libxslt/pattern.c index 31f5a19..787db93 100644 --- a/libxslt/pattern.c +++ b/libxslt/pattern.c @@ -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: diff --git a/libxslt/pattern.h b/libxslt/pattern.h index 00b944b..71fa0ba 100644 --- a/libxslt/pattern.h +++ b/libxslt/pattern.h @@ -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, diff --git a/libxslt/transform.c b/libxslt/transform.c index 1d20bc2..196e722 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -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) &&