add a missing check in xmlAddSibling, patch by Kris Breuker avoid
* tree.c: add a missing check in xmlAddSibling, patch by Kris Breuker
* xmlIO.c: avoid xmlAllocOutputBuffer using XML_BUFFER_EXACT which
leads to performances problems especially on Windows.
daniel
svn path=/trunk/; revision=3820
diff --git a/ChangeLog b/ChangeLog
index 54feb64..1c03942 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Mar 23 20:27:15 CET 2009 Daniel Veillard <daniel@veillard.com>
+
+ * tree.c: add a missing check in xmlAddSibling, patch by Kris Breuker
+ * xmlIO.c: avoid xmlAllocOutputBuffer using XML_BUFFER_EXACT which
+ leads to performances problems especially on Windows.
+
Tue Mar 3 14:30.28 HKT 2009 William Brack <wbrack@mmm.com.hk>
* trio.h: changed include of config.h to be surrounded by
diff --git a/tree.c b/tree.c
index 8e393da..be5c6b9 100644
--- a/tree.c
+++ b/tree.c
@@ -3103,6 +3103,14 @@
return(NULL);
}
+ if (cur == elem) {
+#ifdef DEBUG_TREE
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlAddSibling : cur == elem\n");
+#endif
+ return(NULL);
+ }
+
/*
* Constant time is we can rely on the ->parent->last to find
* the last sibling.
diff --git a/xmlIO.c b/xmlIO.c
index d4dc364..855bf41 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -2278,6 +2278,10 @@
return(NULL);
}
+ /* try to avoid a performance problem with Windows realloc() */
+ if (ret->buffer->alloc == XML_BUFFER_ALLOC_EXACT)
+ ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT;
+
ret->encoder = encoder;
if (encoder != NULL) {
ret->conv = xmlBufferCreateSize(4000);