1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-08-08 21:42:07 +03:00

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
This commit is contained in:
William M. Brack
2006-08-09 18:22:39 +00:00
parent 1564b7c617
commit 4b155f2bb2
7 changed files with 43 additions and 19 deletions

View File

@@ -1,3 +1,11 @@
Wed Aug 9 13:22:13 PDT 2006 William Brack <wbrack@mmm.com.hk>
* 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 <daniel@veillard.com> Fri Aug 4 14:50:41 CEST 2006 Daniel Veillard <daniel@veillard.com>
* python/generator.py: fixed the conversion of long parameters * python/generator.py: fixed the conversion of long parameters

View File

@@ -57,7 +57,7 @@ static void exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt,
int nargs); int nargs);
static exsltFuncFunctionData *exsltFuncNewFunctionData(void); static exsltFuncFunctionData *exsltFuncNewFunctionData(void);
static const xmlChar *exsltResultDataID = (const xmlChar *) "EXSLT Result"; /*static const xmlChar *exsltResultDataID = (const xmlChar *) "EXSLT Result";*/
/** /**
* exsltFuncRegisterFunc: * exsltFuncRegisterFunc:

View File

@@ -324,7 +324,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
const xmlChar *ext_directory = NULL; const xmlChar *ext_directory = NULL;
const xmlChar *protocol = NULL; const xmlChar *protocol = NULL;
xmlChar *i, *regfunc_name; xmlChar *i, *regfunc_name;
int rc, seen_before; int rc;
/* check for bad inputs */ /* check for bad inputs */
if (URI == NULL) if (URI == NULL)
@@ -337,8 +337,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
} }
/* have we attempted to register this module already? */ /* have we attempted to register this module already? */
seen_before = (int) xmlHashLookup(xsltModuleHash, URI); if (xmlHashLookup(xsltModuleHash, URI) != NULL) {
if (0 != seen_before) {
return (-1); return (-1);
} }
@@ -778,8 +777,9 @@ xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar * URI)
return(NULL); return(NULL);
} }
#ifdef XSLT_REFACTORED
/** /**
* xsltStyleGetExtDataPerStylesheetLevel: * xsltStyleStylesheetLevelGetExtData:
* @style: an XSLT stylesheet * @style: an XSLT stylesheet
* @URI: the URI associated to the exension module * @URI: the URI associated to the exension module
* *
@@ -815,6 +815,7 @@ xsltStyleStylesheetLevelGetExtData(xsltStylesheetPtr style,
return (dataContainer->extData); return (dataContainer->extData);
return(NULL); return(NULL);
} }
#endif
/** /**
* xsltGetExtData: * xsltGetExtData:

View File

@@ -813,8 +813,8 @@ xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node,
* Returns: a new xmlNsPtr, or NULL in case of an error. * Returns: a new xmlNsPtr, or NULL in case of an error.
*/ */
xmlNsPtr xmlNsPtr
xsltCopyNamespace(xsltTransformContextPtr ctxt, xmlNodePtr elem, xsltCopyNamespace(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
xmlNsPtr ns) xmlNodePtr elem, xmlNsPtr ns)
{ {
if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL))
return(NULL); return(NULL);

View File

@@ -1316,6 +1316,10 @@ xsltShallowCopyNsNode(xsltTransformContextPtr ctxt,
xmlNodePtr insert, xmlNodePtr insert,
xmlNsPtr ns) 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; xmlNsPtr tmpns;
if ((insert == NULL) || (insert->type != XML_ELEMENT_NODE)) if ((insert == NULL) || (insert->type != XML_ELEMENT_NODE))
@@ -3016,13 +3020,13 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt,
* was not called by the extension author. * was not called by the extension author.
*/ */
if (oldLocalFragmentTop != ctxt->localRVT) { if (oldLocalFragmentTop != ctxt->localRVT) {
xmlDocPtr cur = ctxt->localRVT, tmp; xmlDocPtr curdoc = ctxt->localRVT, tmp;
do { do {
tmp = cur; tmp = curdoc;
cur = (xmlDocPtr) cur->next; curdoc = (xmlDocPtr) curdoc->next;
xsltReleaseRVT(ctxt, tmp); xsltReleaseRVT(ctxt, tmp);
} while (cur != oldLocalFragmentTop); } while (curdoc != oldLocalFragmentTop);
} }
ctxt->localRVT = oldLocalFragmentTop; ctxt->localRVT = oldLocalFragmentTop;
@@ -3033,11 +3037,11 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt,
* of the obsolete xsltRegisterTmpRVT(). * of the obsolete xsltRegisterTmpRVT().
*/ */
if (ctxt->tmpRVT) { if (ctxt->tmpRVT) {
xmlDocPtr cur = ctxt->tmpRVT, tmp; xmlDocPtr curdoc = ctxt->tmpRVT, tmp;
while (cur != NULL) { while (curdoc != NULL) {
tmp = cur; tmp = curdoc;
cur = (xmlDocPtr) cur->next; curdoc = (xmlDocPtr) curdoc->next;
xsltReleaseRVT(ctxt, tmp); xsltReleaseRVT(ctxt, tmp);
} }
} }
@@ -6013,10 +6017,19 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
} }
vptr = vptr->next; 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. * Free all remaining tree fragments.
*/ */
xsltFreeRVTs(ctxt); xsltFreeRVTs(ctxt);
#endif
/* /*
* Do some post processing work depending on the generated output * Do some post processing work depending on the generated output
*/ */

View File

@@ -843,12 +843,13 @@ xsltFreeStylesheetList(xsltStylesheetPtr style) {
* @node: the element where the stylesheet is rooted at * @node: the element where the stylesheet is rooted at
* *
* Actually @node need not be the document-element, but * 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. * Returns 0 if OK, -1 on API or internal errors.
*/ */
static int 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. */ #if 0 /* TODO: Currently disabled, since probably not needed. */
xmlNodePtr cur; xmlNodePtr cur;

View File

@@ -389,15 +389,16 @@ typedef enum {
XSLT_FUNC_PARAM, XSLT_FUNC_PARAM,
XSLT_FUNC_VARIABLE, XSLT_FUNC_VARIABLE,
XSLT_FUNC_WHEN, XSLT_FUNC_WHEN,
XSLT_FUNC_EXTENSION, XSLT_FUNC_EXTENSION
#ifdef XSLT_REFACTORED #ifdef XSLT_REFACTORED
,
XSLT_FUNC_OTHERWISE, XSLT_FUNC_OTHERWISE,
XSLT_FUNC_FALLBACK, XSLT_FUNC_FALLBACK,
XSLT_FUNC_MESSAGE, XSLT_FUNC_MESSAGE,
XSLT_FUNC_INCLUDE, XSLT_FUNC_INCLUDE,
XSLT_FUNC_ATTRSET, XSLT_FUNC_ATTRSET,
XSLT_FUNC_LITERAL_RESULT_ELEMENT, XSLT_FUNC_LITERAL_RESULT_ELEMENT,
XSLT_FUNC_UNKOWN_FORWARDS_COMPAT, XSLT_FUNC_UNKOWN_FORWARDS_COMPAT
#endif #endif
} xsltStyleType; } xsltStyleType;