diff options
| author | William M. Brack <wbrack@src.gnome.org> | 2004-01-04 14:49:01 +0000 |
|---|---|---|
| committer | William M. Brack <wbrack@src.gnome.org> | 2004-01-04 14:49:01 +0000 |
| commit | 7762bb153794461bf52d4b0a1d29599579e5b9e9 (patch) | |
| tree | a3bfa454e7b412671a28ea38d9a4908825b1efc5 /tree.c | |
| parent | 24d9048570dac3dc285c4fac37dd6ec3774d53c6 (diff) | |
| download | android_external_libxml2-7762bb153794461bf52d4b0a1d29599579e5b9e9.tar.gz android_external_libxml2-7762bb153794461bf52d4b0a1d29599579e5b9e9.tar.bz2 android_external_libxml2-7762bb153794461bf52d4b0a1d29599579e5b9e9.zip | |
added a routine xmlStrncatNew to create a new string from 2 frags. added
* parser.c, include/libxml/parser.h: added a routine
xmlStrncatNew to create a new string from 2 frags.
* tree.c: added code to check if node content is from
dictionary before trying to change or concatenate.
Diffstat (limited to 'tree.c')
| -rw-r--r-- | tree.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -5024,7 +5024,9 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) { case XML_PI_NODE: case XML_COMMENT_NODE: if (cur->content != NULL) { - xmlFree(cur->content); + if (!((cur->doc != NULL) && (cur->doc->dict != NULL) && + xmlDictOwns(cur->doc->dict, cur->content))) + xmlFree(cur->content); } if (cur->children != NULL) xmlFreeNodeList(cur->children); cur->last = cur->children = NULL; @@ -5172,6 +5174,12 @@ xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) { case XML_COMMENT_NODE: case XML_NOTATION_NODE: if (content != NULL) { + if ((cur->doc != NULL) && (cur->doc->dict != NULL) && + xmlDictOwns(cur->doc->dict, cur->content)) { + cur->content = + xmlStrncatNew(cur->content, content, len); + break; + } cur->content = xmlStrncat(cur->content, content, len); } case XML_DOCUMENT_NODE: @@ -6362,7 +6370,13 @@ xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) { #endif return(-1); } - node->content = xmlStrncat(node->content, content, len); + /* need to check if content is currently in the dictionary */ + if ((node->doc != NULL) && (node->doc->dict != NULL) && + xmlDictOwns(node->doc->dict, node->content)) { + node->content = xmlStrncatNew(node->content, content, len); + } else { + node->content = xmlStrncat(node->content, content, len); + } if (node->content == NULL) return(-1); return(0); |
