Skip to content
Snippets Groups Projects
Commit 4efb5f10dd91 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

libxslt should deallocate directly text node content use

* libxslt/xslt.c: libxslt should deallocate directly text node content
  use xmlSetNodeContent(..., NULL)
Daniel
parent e277cc6bd369
Branches
No related tags found
No related merge requests found
Thu Aug 25 13:29:20 CEST 2005 Daniel Veillard <daniel@veillard.com>
* libxslt/xslt.c: libxslt should deallocate directly text node content
use xmlSetNodeContent(..., NULL)
Fri Aug 12 12:17:10 CEST 2005 Daniel Veillard <daniel@veillard.com>
* tests/general/bug-163.*, tests/general/Makefile.am,
......
......@@ -1218,10 +1218,10 @@
if ((txt != NULL) && (txt->type == XML_TEXT_NODE) &&
(txt->content != NULL) &&
(!xmlDictOwns(style->dict, txt->content))) {
xmlChar *old = (xmlChar *) txt->content;
xmlChar *tmp;
/*
* internalize the text string, goal is to speed
* up operations and minimize used space by compiled
* stylesheets.
*/
......@@ -1222,13 +1222,15 @@
/*
* internalize the text string, goal is to speed
* up operations and minimize used space by compiled
* stylesheets.
*/
txt->content = (xmlChar *)
xmlDictLookup(style->dict, old, -1);
if (old != txt->content)
xmlFree(old);
tmp = (xmlChar *) xmlDictLookup(style->dict,
txt->content, -1);
if (tmp != txt->content) {
xmlNodeSetContent(txt, NULL);
txt->content = tmp;
}
}
prop = prop->next;
}
......@@ -1302,10 +1304,10 @@
}
} else if ((cur->content != NULL) && (internalize) &&
(!xmlDictOwns(style->dict, cur->content))) {
xmlChar *old = (xmlChar *) cur->content;
xmlChar *tmp;
/*
* internalize the text string, goal is to speed
* up operations and minimize used space by compiled
* stylesheets.
*/
......@@ -1306,11 +1308,12 @@
/*
* internalize the text string, goal is to speed
* up operations and minimize used space by compiled
* stylesheets.
*/
cur->content = (xmlChar *) xmlDictLookup(style->dict, old, -1);
xmlFree(old);
tmp = (xmlChar *) xmlDictLookup(style->dict, cur->content, -1);
xmlNodeSetContent(cur, NULL);
cur->content = tmp;
}
} else if ((cur->type != XML_ELEMENT_NODE) &&
(cur->type != XML_CDATA_SECTION_NODE)) {
......@@ -1537,11 +1540,14 @@
* internalize the text string
*/
if (text->doc->dict != NULL) {
xmlChar *old = (xmlChar *) text->content;
text->content =
(xmlChar *) xmlDictLookup(
text->doc->dict, old, -1);
xmlFree(old);
const xmlChar *tmp;
tmp = xmlDictLookup(text->doc->dict,
text->content, -1);
if (tmp != text->content) {
xmlNodeSetContent(text, NULL);
text->content = (xmlChar *) tmp;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment