trying to fix at least the message from bug #158628 added first xmlsave

* xmlschemastypes.c: trying to fix at least the message from
  bug #158628
* include/libxml/xmlsave.h xmlsave.c: added first xmlsave option
  for format, c.f. bug #159997
Daniel
diff --git a/ChangeLog b/ChangeLog
index 17ff210..2dc6baf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sun Jan 16 01:04:18 CET 2005 Daniel Veillard <daniel@veillard.com>
+
+	* xmlschemastypes.c: trying to fix at least the message from
+	  bug #158628
+	* include/libxml/xmlsave.h xmlsave.c: added first xmlsave option
+	  for format, c.f. bug #159997
+
 Sat Jan 15 18:44:30 CET 2005 Daniel Veillard <daniel@veillard.com>
 
 	* python/libxml.py: make __str__ call serialize() on nodes, c.f. 
diff --git a/include/libxml/xmlsave.h b/include/libxml/xmlsave.h
index be5971d..534fefd 100644
--- a/include/libxml/xmlsave.h
+++ b/include/libxml/xmlsave.h
@@ -20,6 +20,17 @@
 extern "C" {
 #endif
 
+/**
+ * xmlSaveOption:
+ *
+ * This is the set of XML save options that can be passed down
+ * to the xmlSaveToFd() and similar calls.
+ */
+typedef enum {
+    XML_SAVE_FORMAT     = 1<<0	/* format save output */
+} xmlSaveOption;
+
+
 typedef struct _xmlSaveCtxt xmlSaveCtxt;
 typedef xmlSaveCtxt *xmlSaveCtxtPtr;
 
diff --git a/xmlsave.c b/xmlsave.c
index 72ad699..a774bc8 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -377,7 +377,14 @@
 	return ( NULL );
     }
     memset(ret, 0, sizeof(xmlSaveCtxt));
+
+    /*
+     * Use the options
+     */
     ret->options = options;
+    if (options & XML_SAVE_FORMAT)
+        ret->format = 1;
+
     if (encoding != NULL) {
         ret->handler = xmlFindCharEncodingHandler(encoding);
 	if (ret->handler == NULL) {
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 4d9be10..622f683 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -1656,6 +1656,9 @@
     if (val == NULL) {
 	return(-1);
     }
+    if (ret != NULL) {
+        *ret = NULL;
+    }
     cur = val;
     /*
      * Split the list
@@ -1673,9 +1676,6 @@
 	}
     }
     if (nb_values == 0) {
-	if (ret != NULL) {
-	    TODO
-	}
 	xmlFree(val);
 	return(nb_values);
     }
@@ -1689,10 +1689,11 @@
 	while (*cur != 0) cur++;
 	while ((*cur == 0) && (cur != endval)) cur++;
     }
-    xmlFree(val);
+    /* TODO what return value ? c.f. bug #158628
     if (ret != NULL) {
 	TODO
-    }
+    } */
+    xmlFree(val);
     if (tmp == 0)
 	return(nb_values);
     return(-1);