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/ChangeLog b/ChangeLog
index 74f8e11..c5f0c19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Nov  9 13:07:24 EST 2005 Rob Richards <rrichards@ctindustries.net>
+
+	* xmlIO.c xmlwriter.c: function consolidation when writing to xmlBuffer.
+	  Return error condition not len if xmlwriter fails writing to buffer.
+
 Wed Nov  9 09:54:54 CET 2005 Daniel Veillard <daniel@veillard.com>
 
 	* xmlsave.c xmlIO.c include/libxml/xmlIO.h include/libxml/xmlsave.h:
diff --git a/xmlIO.c b/xmlIO.c
index 9e302ae..f30f775 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -2490,12 +2490,11 @@
 
     if (buffer == NULL) return(NULL);
 
-    ret = xmlAllocOutputBuffer(encoder);
-    if (ret != NULL) {
-        ret->context = buffer;
-        ret->writecallback = xmlBufferWrite;
-        ret->closecallback = xmlBufferClose;
-    }
+    ret = xmlOutputBufferCreateIO((xmlOutputWriteCallback)
+                                  xmlBufferWrite,
+                                  (xmlOutputCloseCallback)
+                                  xmlBufferClose,
+                                  (void *) buffer, encoder);
 
     return(ret);
 }
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");