[libxml2] When calling xmlNodeDump make sure we grow the buffer quickly
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] When calling xmlNodeDump make sure we grow the buffer quickly
- Date: Mon, 11 Feb 2013 04:02:35 +0000 (UTC)
commit 23922c536c97e0eaac4bd7fbe68cbf9fceb66b36
Author: Daniel Veillard <veillard redhat com>
Date: Mon Feb 11 11:52:44 2013 +0800
When calling xmlNodeDump make sure we grow the buffer quickly
Make sure the underlying new buffer allocated use a double-it scheme
for the time of the dump.
xmlsave.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/xmlsave.c b/xmlsave.c
index 829abb3..774404b 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -2247,6 +2247,7 @@ xmlBufNodeDump(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
size_t use;
int ret;
xmlOutputBufferPtr outbuf;
+ int oldalloc;
xmlInitParser();
@@ -2278,7 +2279,10 @@ xmlBufNodeDump(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
outbuf->written = 0;
use = xmlBufUse(buf);
+ oldalloc = xmlBufGetAllocationScheme(buf);
+ xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
xmlNodeDumpOutput(outbuf, doc, cur, level, format, NULL);
+ xmlBufSetAllocationScheme(buf, oldalloc);
xmlFree(outbuf);
ret = xmlBufUse(buf) - use;
return (ret);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]