function consolidation when writing to xmlBuffer. Return error condition
* xmlIO.c xmlwriter.c: function consolidation when writing to xmlBuffer.
Return error condition not len if xmlwriter fails writing to buffer.
diff --git a/xmlwriter.c b/xmlwriter.c
index 25e45fa..5911347 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -99,9 +99,6 @@
static void xmlFreeTextWriterNsStackEntry(xmlLinkPtr lk);
static int xmlCmpTextWriterNsStackEntry(const void *data0,
const void *data1);
-static int xmlTextWriterWriteMemCallback(void *context,
- const xmlChar * str, int len);
-static int xmlTextWriterCloseMemCallback(void *context);
static int xmlTextWriterWriteDocCallback(void *context,
const xmlChar * str, int len);
static int xmlTextWriterCloseDocCallback(void *context);
@@ -275,11 +272,8 @@
xmlOutputBufferPtr out;
/*::todo handle compression */
- out = xmlOutputBufferCreateIO((xmlOutputWriteCallback)
- xmlTextWriterWriteMemCallback,
- (xmlOutputCloseCallback)
- xmlTextWriterCloseMemCallback,
- (void *) buf, NULL);
+ out = xmlOutputBufferCreateBuffer(buf, NULL);
+
if (out == NULL) {
xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY,
"xmlNewTextWriterMemory : out of memory!\n");