From 4b155f2bb20ed044b3569a9b5067bcbfdba8a4a4 Mon Sep 17 00:00:00 2001 From: "William M. Brack" Date: Wed, 9 Aug 2006 18:22:39 +0000 Subject: [PATCH] Fixed problem with cleanup of RVT's, should clear bug350085; cleaned up * libxslt/transform.c: Fixed problem with cleanup of RVT's, should clear bug350085; cleaned up most warnings (still a problem in xsltShallowCopyNsNode) * trivial warning cleanup in libxslt/[extensions.c, namespaces.c, xslt.c and xsltInternals.h] and libexslt/functions.c --- ChangeLog | 8 ++++++++ libexslt/functions.c | 2 +- libxslt/extensions.c | 9 +++++---- libxslt/namespaces.c | 4 ++-- libxslt/transform.c | 29 +++++++++++++++++++++-------- libxslt/xslt.c | 5 +++-- libxslt/xsltInternals.h | 5 +++-- 7 files changed, 43 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index d4fdded9..8c460b9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Wed Aug 9 13:22:13 PDT 2006 William Brack + + * libxslt/transform.c: Fixed problem with cleanup of RVT's, should + clear bug350085; cleaned up most warnings (still a problem in + xsltShallowCopyNsNode) + * trivial warning cleanup in libxslt/[extensions.c, namespaces.c, + xslt.c and xsltInternals.h] and libexslt/functions.c + Fri Aug 4 14:50:41 CEST 2006 Daniel Veillard * python/generator.py: fixed the conversion of long parameters diff --git a/libexslt/functions.c b/libexslt/functions.c index 2cf7249d..bbeb182a 100644 --- a/libexslt/functions.c +++ b/libexslt/functions.c @@ -57,7 +57,7 @@ static void exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs); static exsltFuncFunctionData *exsltFuncNewFunctionData(void); -static const xmlChar *exsltResultDataID = (const xmlChar *) "EXSLT Result"; +/*static const xmlChar *exsltResultDataID = (const xmlChar *) "EXSLT Result";*/ /** * exsltFuncRegisterFunc: diff --git a/libxslt/extensions.c b/libxslt/extensions.c index b28ad6b4..ddd54762 100644 --- a/libxslt/extensions.c +++ b/libxslt/extensions.c @@ -324,7 +324,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI) const xmlChar *ext_directory = NULL; const xmlChar *protocol = NULL; xmlChar *i, *regfunc_name; - int rc, seen_before; + int rc; /* check for bad inputs */ if (URI == NULL) @@ -337,8 +337,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI) } /* have we attempted to register this module already? */ - seen_before = (int) xmlHashLookup(xsltModuleHash, URI); - if (0 != seen_before) { + if (xmlHashLookup(xsltModuleHash, URI) != NULL) { return (-1); } @@ -778,8 +777,9 @@ xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar * URI) return(NULL); } +#ifdef XSLT_REFACTORED /** - * xsltStyleGetExtDataPerStylesheetLevel: + * xsltStyleStylesheetLevelGetExtData: * @style: an XSLT stylesheet * @URI: the URI associated to the exension module * @@ -815,6 +815,7 @@ xsltStyleStylesheetLevelGetExtData(xsltStylesheetPtr style, return (dataContainer->extData); return(NULL); } +#endif /** * xsltGetExtData: diff --git a/libxslt/namespaces.c b/libxslt/namespaces.c index e27e0e55..a8ba8e2e 100644 --- a/libxslt/namespaces.c +++ b/libxslt/namespaces.c @@ -813,8 +813,8 @@ xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node, * Returns: a new xmlNsPtr, or NULL in case of an error. */ xmlNsPtr -xsltCopyNamespace(xsltTransformContextPtr ctxt, xmlNodePtr elem, - xmlNsPtr ns) +xsltCopyNamespace(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, + xmlNodePtr elem, xmlNsPtr ns) { if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) return(NULL); diff --git a/libxslt/transform.c b/libxslt/transform.c index e9eda83f..75947162 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -1316,6 +1316,10 @@ xsltShallowCopyNsNode(xsltTransformContextPtr ctxt, xmlNodePtr insert, xmlNsPtr ns) { + /* + * TODO: Contrary to header comments, this is declared as int. + * be modified to return a node pointer, or NULL if any error + */ xmlNsPtr tmpns; if ((insert == NULL) || (insert->type != XML_ELEMENT_NODE)) @@ -3016,13 +3020,13 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, * was not called by the extension author. */ if (oldLocalFragmentTop != ctxt->localRVT) { - xmlDocPtr cur = ctxt->localRVT, tmp; + xmlDocPtr curdoc = ctxt->localRVT, tmp; do { - tmp = cur; - cur = (xmlDocPtr) cur->next; + tmp = curdoc; + curdoc = (xmlDocPtr) curdoc->next; xsltReleaseRVT(ctxt, tmp); - } while (cur != oldLocalFragmentTop); + } while (curdoc != oldLocalFragmentTop); } ctxt->localRVT = oldLocalFragmentTop; @@ -3033,11 +3037,11 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, * of the obsolete xsltRegisterTmpRVT(). */ if (ctxt->tmpRVT) { - xmlDocPtr cur = ctxt->tmpRVT, tmp; + xmlDocPtr curdoc = ctxt->tmpRVT, tmp; - while (cur != NULL) { - tmp = cur; - cur = (xmlDocPtr) cur->next; + while (curdoc != NULL) { + tmp = curdoc; + curdoc = (xmlDocPtr) curdoc->next; xsltReleaseRVT(ctxt, tmp); } } @@ -6013,10 +6017,19 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc, } vptr = vptr->next; } +#if 0 + /* + * code disabled by wmb; awaiting kb's review + * problem is that global variable(s) may contain xpath objects + * from doc associated with RVT, so can't be freed at this point. + * xsltFreeTransformContext includes a call to xsltFreeRVTs, so + * I assume this shouldn't be required at this point. + */ /* * Free all remaining tree fragments. */ xsltFreeRVTs(ctxt); +#endif /* * Do some post processing work depending on the generated output */ diff --git a/libxslt/xslt.c b/libxslt/xslt.c index 650a2ca7..5d39e863 100644 --- a/libxslt/xslt.c +++ b/libxslt/xslt.c @@ -843,12 +843,13 @@ xsltFreeStylesheetList(xsltStylesheetPtr style) { * @node: the element where the stylesheet is rooted at * * Actually @node need not be the document-element, but - * currently Libxslt does not support embedeed stylesheets. + * currently Libxslt does not support embedded stylesheets. * * Returns 0 if OK, -1 on API or internal errors. */ static int -xsltCleanupStylesheetTree(xmlDocPtr doc, xmlNodePtr rootElem) +xsltCleanupStylesheetTree(xmlDocPtr doc ATTRIBUTE_UNUSED, + xmlNodePtr rootElem ATTRIBUTE_UNUSED) { #if 0 /* TODO: Currently disabled, since probably not needed. */ xmlNodePtr cur; diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h index 62062c5b..8b995c80 100644 --- a/libxslt/xsltInternals.h +++ b/libxslt/xsltInternals.h @@ -389,15 +389,16 @@ typedef enum { XSLT_FUNC_PARAM, XSLT_FUNC_VARIABLE, XSLT_FUNC_WHEN, - XSLT_FUNC_EXTENSION, + XSLT_FUNC_EXTENSION #ifdef XSLT_REFACTORED + , XSLT_FUNC_OTHERWISE, XSLT_FUNC_FALLBACK, XSLT_FUNC_MESSAGE, XSLT_FUNC_INCLUDE, XSLT_FUNC_ATTRSET, XSLT_FUNC_LITERAL_RESULT_ELEMENT, - XSLT_FUNC_UNKOWN_FORWARDS_COMPAT, + XSLT_FUNC_UNKOWN_FORWARDS_COMPAT #endif } xsltStyleType;