applied patch from Aron Stansvik to add xmlTextReaderByteConsumed() added

* xmlreader.c include/libxml/xmlreader.h: applied patch from
  Aron Stansvik to add xmlTextReaderByteConsumed()
* testReader.c: added a test option
* xmlschemastypes.c: fix a lack of pointer checking in APIs
Daniel
diff --git a/xmlreader.c b/xmlreader.c
index 4215261..e5b8898 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -4517,6 +4517,27 @@
 }
 
 /**
+ * xmlTextReaderByteConsumed:
+ * @reader: an XML reader
+ *
+ * This function provides the current index of the parser used
+ * by the reader, relative to the start of the current entity.
+ * This function actually just wraps a call to xmlBytesConsumed()
+ * for the parser context associated with the reader.
+ * See xmlBytesConsumed() for more information.
+ *
+ * Returns the index in bytes from the beginning of the entity or -1
+ *         in case the index could not be computed.
+ */
+long
+xmlTextReaderByteConsumed(xmlTextReaderPtr reader) {
+    if ((reader == NULL) || (reader->ctxt == NULL))
+        return(-1);
+    return(xmlByteConsumed(reader->ctxt));
+}
+ 
+
+/**
  * xmlReaderWalker:
  * @doc:  a preparsed document
  *