1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

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
This commit is contained in:
Daniel Veillard 2009-03-23 19:32:04 +00:00
parent ec5b1fd1f4
commit 43bc89c1e3
3 changed files with 18 additions and 0 deletions

View File

@ -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

8
tree.c
View File

@ -3103,6 +3103,14 @@ xmlAddSibling(xmlNodePtr cur, xmlNodePtr elem) {
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.

View File

@ -2278,6 +2278,10 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) {
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);