diff options
author | Kasimier T. Buchcik <kbuchcik@src.gnome.org> | 2006-08-10 11:37:37 +0000 |
---|---|---|
committer | Kasimier T. Buchcik <kbuchcik@src.gnome.org> | 2006-08-10 11:37:37 +0000 |
commit | 8700dbb5039784a6b39477616d1067863f172f1d (patch) | |
tree | 75ca355b105c079b966b3a7e26c48e82a0d0b09d | |
parent | 4b155f2bb20ed044b3569a9b5067bcbfdba8a4a4 (diff) | |
download | libxslt-8700dbb5039784a6b39477616d1067863f172f1d.tar.gz libxslt-8700dbb5039784a6b39477616d1067863f172f1d.tar.bz2 libxslt-8700dbb5039784a6b39477616d1067863f172f1d.zip |
As suggested by Bill, I changed xsltShallowCopyNsNode() to return an
* libxslt/transform.c: As suggested by Bill, I changed
xsltShallowCopyNsNode() to return an xmlNsPtr instead of
an int. The fix of bug #350085 is OK; i.e. the removal
of the call to xsltFreeRVTs() in
xsltApplyStylesheetInternal(). I think I tried to clear
the transformation context as much as possible, in case
it is reused; Daniel informed me on the list that reusing
the context is not intended, so no need anymore to try
to free the fragments immediately after the transformation.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | libxslt/transform.c | 23 |
2 files changed, 25 insertions, 10 deletions
@@ -1,3 +1,15 @@ +Thu Aug 10 13:27:48 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net> + + * libxslt/transform.c: As suggested by Bill, I changed + xsltShallowCopyNsNode() to return an xmlNsPtr instead of + an int. The fix of bug #350085 is OK; i.e. the removal + of the call to xsltFreeRVTs() in + xsltApplyStylesheetInternal(). I think I tried to clear + the transformation context as much as possible, in case + it is reused; Daniel informed me on the list that reusing + the context is not intended, so no need anymore to try + to free the fragments immediately after the transformation. + 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 diff --git a/libxslt/transform.c b/libxslt/transform.c index 75947162..12233af1 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -1205,7 +1205,8 @@ xsltShallowCopyElem(xsltTransformContextPtr ctxt, xmlNodePtr node, * @invocNode: responsible node in the stylesheet; used for error reports * @list: the list of element nodes in the source tree. * @insert: the parent in the result tree. - * @literal: is this a literal result element list + * @isLRE: is this a literal result element list + * @topElemVisited: indicates if a top-most element was already processed * * Make a copy of the full list of tree @list * and insert it as last children of @insert @@ -1310,7 +1311,7 @@ xsltCopyNamespaceListInternal(xmlNodePtr elem, xmlNsPtr ns) { * * Returns a new/existing ns-node, or NULL. */ -static int +static xmlNsPtr xsltShallowCopyNsNode(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, xmlNodePtr insert, @@ -1323,13 +1324,13 @@ xsltShallowCopyNsNode(xsltTransformContextPtr ctxt, xmlNsPtr tmpns; if ((insert == NULL) || (insert->type != XML_ELEMENT_NODE)) - return(-1); + return(NULL); if (insert->children != NULL) { xsltTransformError(ctxt, NULL, invocNode, "Namespace nodes must be added before " "any child nodes are added to an element.\n"); - return(1); + return(NULL); } /* * @@ -1360,7 +1361,10 @@ xsltShallowCopyNsNode(xsltTransformContextPtr ctxt, } else if ((ns->prefix[0] == 'x') && xmlStrEqual(ns->prefix, BAD_CAST "xml")) { - return(0); + /* + * The XML namespace is built in. + */ + return(NULL); } if (insert->nsDef != NULL) { @@ -1374,7 +1378,7 @@ xsltShallowCopyNsNode(xsltTransformContextPtr ctxt, * Same prefix. */ if (xmlStrEqual(tmpns->href, ns->href)) - return(0); + return(NULL); goto occupied; } } @@ -1383,22 +1387,21 @@ xsltShallowCopyNsNode(xsltTransformContextPtr ctxt, } tmpns = xmlSearchNs(insert->doc, insert, ns->prefix); if ((tmpns != NULL) && xmlStrEqual(tmpns->href, ns->href)) - return(0); + return(NULL); /* * Declare a new namespace. * TODO: The problem (wrt efficiency) with this xmlNewNs() is * that it will again search the already declared namespaces * for a duplicate :-/ */ - xmlNewNs(insert, ns->href, ns->prefix); - return(0); + return(xmlNewNs(insert, ns->href, ns->prefix)); occupied: /* * TODO: We could as well raise an error here (like Saxon does), * or at least generate a warning. */ - return(0); + return(NULL); } /** |