added a parser XML_PARSE_COMPACT option to allocate small text nodes (less
* HTMLparser.c parser.c SAX2.c debugXML.c tree.c valid.c xmlreader.c
xmllint.c include/libxml/HTMLparser.h include/libxml/parser.h:
added a parser XML_PARSE_COMPACT option to allocate small
text nodes (less than 8 bytes on 32bits, less than 16bytes on 64bits)
directly within the node, various changes to cope with this.
* result/XPath/tests/* result/XPath/xptr/* result/xmlid/*: this
slightly change the output
Daniel
diff --git a/xmlreader.c b/xmlreader.c
index 5fdf3a5..7efa273 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -348,7 +348,8 @@
(cur->type == XML_XINCLUDE_END)) &&
(cur->properties != NULL))
xmlTextReaderFreePropList(reader, cur->properties);
- if ((cur->type != XML_ELEMENT_NODE) &&
+ if ((cur->content != (xmlChar *) &(cur->properties)) &&
+ (cur->type != XML_ELEMENT_NODE) &&
(cur->type != XML_XINCLUDE_START) &&
(cur->type != XML_XINCLUDE_END) &&
(cur->type != XML_ENTITY_REF_NODE)) {
@@ -422,7 +423,8 @@
(cur->type == XML_XINCLUDE_END)) &&
(cur->properties != NULL))
xmlTextReaderFreePropList(reader, cur->properties);
- if ((cur->type != XML_ELEMENT_NODE) &&
+ if ((cur->content != (xmlChar *) &(cur->properties)) &&
+ (cur->type != XML_ELEMENT_NODE) &&
(cur->type != XML_XINCLUDE_START) &&
(cur->type != XML_XINCLUDE_END) &&
(cur->type != XML_ENTITY_REF_NODE)) {
@@ -2810,7 +2812,9 @@
reader->faketext = xmlNewDocText(reader->node->doc,
ns->href);
} else {
- if (reader->faketext->content != NULL)
+ if ((reader->faketext->content != NULL) &&
+ (reader->faketext->content !=
+ (xmlChar *) &(reader->faketext->properties)))
xmlFree(reader->faketext->content);
reader->faketext->content = xmlStrdup(ns->href);
}
@@ -4776,6 +4780,12 @@
if (reader == NULL)
return (-1);
+ /*
+ * we force the generation of compact text nodes on the reader
+ * since usr applications should never modify the tree
+ */
+ options |= XML_PARSE_COMPACT;
+
reader->doc = NULL;
reader->entNr = 0;
reader->parserFlags = options;