code cleanup, especially the function comments. fixed a small bug when

* DOCBparser.c HTMLparser.c c14n.c debugXML.c encoding.c hash.c
  nanoftp.c nanohttp.c parser.c parserInternals.c testC14N.c
  testDocbook.c threads.c tree.c valid.c xmlIO.c xmllint.c xmlmemory.c
  xmlreader.c xmlregexp.c xmlschemas.c xmlschemastypes.c xpath.c:
  code cleanup, especially the function comments.
* tree.c: fixed a small bug when freeing nodes which are XInclude ones.
Daniel
diff --git a/ChangeLog b/ChangeLog
index 233ec93..ba2758e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue Dec 10 16:16:34 CET 2002 Daniel Veillard <daniel@veillard.com>
+
+	* DOCBparser.c HTMLparser.c c14n.c debugXML.c encoding.c hash.c
+	  nanoftp.c nanohttp.c parser.c parserInternals.c testC14N.c
+	  testDocbook.c threads.c tree.c valid.c xmlIO.c xmllint.c xmlmemory.c
+	  xmlreader.c xmlregexp.c xmlschemas.c xmlschemastypes.c xpath.c:
+	  code cleanup, especially the function comments.
+	* tree.c: fixed a small bug when freeing nodes which are XInclude ones.
+
 Mon Dec  9 15:08:17 CET 2002 Daniel Veillard <daniel@veillard.com>
 
 	* Makefile.am xmlreader.c include/libxml/Makefile.am
diff --git a/DOCBparser.c b/DOCBparser.c
index 33c0534..840b309 100644
--- a/DOCBparser.c
+++ b/DOCBparser.c
@@ -3459,7 +3459,7 @@
 
 
 /**
- * docbParseDocTypeDecl :
+ * docbParseDocTypeDecl:
  * @ctxt:  an SGML parser context
  *
  * parse a DOCTYPE declaration
@@ -4791,7 +4791,7 @@
 }
 
 /**
- * docbParseDocument :
+ * docbParseDocument:
  * @ctxt:  an SGML parser context
  * 
  * parse an SGML document (and build a tree if using the standard SAX
@@ -5004,7 +5004,7 @@
 }
 
 /**
- * docbCreateDocParserCtxt :
+ * docbCreateDocParserCtxt:
  * @cur:  a pointer to an array of xmlChar
  * @encoding: the SGML document encoding, or NULL
  *
@@ -5631,7 +5631,7 @@
                } else {
                    /* TODO Avoid the extra copy, handle directly !!!!!! */
                    /*
-                    * Goal of the following test is :
+                    * Goal of the following test is:
                     *  - minimize calls to the SAX 'character' callback
                     *    when they are mergeable
                     */
@@ -5869,7 +5869,7 @@
  ************************************************************************/
 
 /**
- * docbCreatePushParserCtxt :
+ * docbCreatePushParserCtxt:
  * @sax:  a SAX handler
  * @user_data:  The user data returned on SAX callbacks
  * @chunk:  a pointer to an array of chars
@@ -5949,7 +5949,7 @@
 }
 
 /**
- * docbSAXParseDoc :
+ * docbSAXParseDoc:
  * @cur:  a pointer to an array of xmlChar
  * @encoding:  a free form C string describing the SGML document encoding, or NULL
  * @sax:  the SAX handler block
@@ -5989,7 +5989,7 @@
 }
 
 /**
- * docbParseDoc :
+ * docbParseDoc:
  * @cur:  a pointer to an array of xmlChar
  * @encoding:  a free form C string describing the SGML document encoding, or NULL
  *
@@ -6005,7 +6005,7 @@
 
 
 /**
- * docbCreateFileParserCtxt :
+ * docbCreateFileParserCtxt:
  * @filename:  the filename
  * @encoding:  the SGML document encoding, or NULL
  *
@@ -6058,7 +6058,7 @@
 }
 
 /**
- * docbSAXParseFile :
+ * docbSAXParseFile:
  * @filename:  the filename
  * @encoding:  a free form C string describing the SGML document encoding, or NULL
  * @sax:  the SAX handler block
@@ -6100,7 +6100,7 @@
 }
 
 /**
- * docbParseFile :
+ * docbParseFile:
  * @filename:  the filename
  * @encoding:  a free form C string describing document encoding, or NULL
  *
diff --git a/HTMLparser.c b/HTMLparser.c
index e846567..7db3e9e 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -2623,7 +2623,7 @@
 
 
 /**
- * htmlParseDocTypeDecl :
+ * htmlParseDocTypeDecl:
  * @ctxt:  an HTML parser context
  *
  * parse a DOCTYPE declaration
@@ -3544,7 +3544,7 @@
 }
 
 /**
- * htmlParseDocument :
+ * htmlParseDocument:
  * @ctxt:  an HTML parser context
  * 
  * parse an HTML document (and build a tree if using the standard SAX
@@ -3833,7 +3833,7 @@
 }
 
 /**
- * htmlCreateDocParserCtxt :
+ * htmlCreateDocParserCtxt:
  * @cur:  a pointer to an array of xmlChar
  * @encoding:  a free form C string describing the HTML document encoding, or NULL
  *
@@ -4491,7 +4491,7 @@
 		    } else {
 			/* TODO Avoid the extra copy, handle directly !!!!!! */
 			/*
-			 * Goal of the following test is :
+			 * Goal of the following test is:
 			 *  - minimize calls to the SAX 'character' callback
 			 *    when they are mergeable
 			 */
@@ -4727,7 +4727,7 @@
  ************************************************************************/
 
 /**
- * htmlCreatePushParserCtxt :
+ * htmlCreatePushParserCtxt:
  * @sax:  a SAX handler
  * @user_data:  The user data returned on SAX callbacks
  * @chunk:  a pointer to an array of chars
@@ -4809,7 +4809,7 @@
 }
 
 /**
- * htmlSAXParseDoc :
+ * htmlSAXParseDoc:
  * @cur:  a pointer to an array of xmlChar
  * @encoding:  a free form C string describing the HTML document encoding, or NULL
  * @sax:  the SAX handler block
@@ -4852,7 +4852,7 @@
 }
 
 /**
- * htmlParseDoc :
+ * htmlParseDoc:
  * @cur:  a pointer to an array of xmlChar
  * @encoding:  a free form C string describing the HTML document encoding, or NULL
  *
@@ -4868,7 +4868,7 @@
 
 
 /**
- * htmlCreateFileParserCtxt :
+ * htmlCreateFileParserCtxt:
  * @filename:  the filename
  * @encoding:  a free form C string describing the HTML document encoding, or NULL
  *
@@ -4933,7 +4933,7 @@
 }
 
 /**
- * htmlSAXParseFile :
+ * htmlSAXParseFile:
  * @filename:  the filename
  * @encoding:  a free form C string describing the HTML document encoding, or NULL
  * @sax:  the SAX handler block
@@ -4978,7 +4978,7 @@
 }
 
 /**
- * htmlParseFile :
+ * htmlParseFile:
  * @filename:  the filename
  * @encoding:  a free form C string describing the HTML document encoding, or NULL
  *
diff --git a/c14n.c b/c14n.c
index e80536e..cd410cc 100644
--- a/c14n.c
+++ b/c14n.c
@@ -283,8 +283,8 @@
 
 /**
  * xmlC14NVisibleNsStackFind:
- * @ctx			the C14N context 
- * @ns			the namespace to check
+ * @ctx:		the C14N context 
+ * @ns:			the namespace to check
  *
  * Checks whether the given namespace was already rendered or not
  *
diff --git a/debugXML.c b/debugXML.c
index 9652c9f..07a0168 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -2052,7 +2052,7 @@
 }
 
 /**
- * xmlShell
+ * xmlShell:
  * @doc:  the initial document
  * @filename:  the output buffer
  * @input:  the line reading function
diff --git a/encoding.c b/encoding.c
index ebb1eec..69d67cd 100644
--- a/encoding.c
+++ b/encoding.c
@@ -193,7 +193,7 @@
 }
 
 /**
- * xmlCheckUTF8: Check utf-8 string for legality.
+ * xmlCheckUTF8:
  * @utf: Pointer to putative utf-8 encoded string.
  *
  * Checks @utf for being valid utf-8. @utf is assumed to be
diff --git a/hash.c b/hash.c
index dbf634e..2a4d000 100644
--- a/hash.c
+++ b/hash.c
@@ -537,14 +537,6 @@
     return(NULL);
 }
 
-/**
- * xmlHashScan:
- * @table: the hash table
- * @f:  the scanner function for items in the hash
- * @data:  extra data passed to f
- *
- * Scan the hash @table and applied @f to each value.
- */
 typedef struct {
     xmlHashScanner hashscanner;
     void *data;
@@ -558,6 +550,14 @@
     stubdata->hashscanner (payload, stubdata->data, (xmlChar *) name);
 }                                  
  
+/**
+ * xmlHashScan:
+ * @table: the hash table
+ * @f:  the scanner function for items in the hash
+ * @data:  extra data passed to f
+ *
+ * Scan the hash @table and applied @f to each value.
+ */
 void
 xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) {
     stubData stubdata;
@@ -752,13 +752,14 @@
  *
  * Returns 0 if the removal succeeded and -1 in case of error or not found.
  */
-int xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
+int
+xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
 			const xmlChar *name2, xmlHashDeallocator f) {
     return(xmlHashRemoveEntry3(table, name, name2, NULL, f));
 }
 
 /**
- * xmlHashRemoveEntry3
+ * xmlHashRemoveEntry3:
  * @table: the hash table
  * @name: the name of the userdata
  * @name2: a second name of the userdata
@@ -771,7 +772,8 @@
  *
  * Returns 0 if the removal succeeded and -1 in case of error or not found.
  */
-int xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
+int
+xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
     const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator f) {
     unsigned long key;
     xmlHashEntryPtr entry;
diff --git a/nanoftp.c b/nanoftp.c
index dddec74..d3c1e28 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -1853,12 +1853,14 @@
  * 			Basic test in Standalone mode			*
  * 									*
  ************************************************************************/
+static
 void ftpList(void *userData, const char *filename, const char* attrib,
 	     const char *owner, const char *group, unsigned long size, int links,
 	     int year, const char *month, int day, int hour, int minute) {
     xmlGenericError(xmlGenericErrorContext,
 	    "%s %s %s %ld %s\n", attrib, owner, group, size, filename);
 }
+static
 void ftpData(void *userData, const char *data, int len) {
     if (userData == NULL) return;
     if (len <= 0) {
diff --git a/nanohttp.c b/nanohttp.c
index bc4936f..c07587e 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -1419,7 +1419,7 @@
 }
 
 /**
- * xmlNanoHTTPContentLength
+ * xmlNanoHTTPContentLength:
  * @ctx:  the HTTP context
  *
  * Return the specified content length from the HTTP header.  Note that
@@ -1434,7 +1434,7 @@
 }
 
 /**
- * xmlNanoHTTPFetchContent
+ * xmlNanoHTTPFetchContent:
  * @ctx:  the HTTP context
  * @ptr:  pointer to set to the content buffer.
  * @len:  integer pointer to hold the length of the content
diff --git a/parser.c b/parser.c
index 864f693..a38245e 100644
--- a/parser.c
+++ b/parser.c
@@ -1234,7 +1234,6 @@
 /**
  * xmlCharStrdup:
  * @cur:  the input char *
- * @len:  the len of @cur
  *
  * a strdup for char's to xmlChar's
  *
@@ -2390,6 +2389,16 @@
     return ret;
 }
 
+/**
+ * xmlParseAttValueComplex:
+ * @ctxt:  an XML parser context
+ *
+ * parse a value for an attribute, this is the fallback function
+ * of xmlParseAttValue() when the attribute parsing requires handling
+ * of non-ASCII characters.
+ *
+ * Returns the AttValue parsed or NULL. The value has to be freed by the caller.
+ */
 xmlChar *
 xmlParseAttValueComplex(xmlParserCtxtPtr ctxt) {
     xmlChar limit = 0;
@@ -2838,6 +2847,15 @@
     xmlParseCharDataComplex(ctxt, cdata);
 }
 
+/**
+ * xmlParseCharDataComplex:
+ * @ctxt:  an XML parser context
+ * @cdata:  int indicating whether we are within a CDATA section
+ *
+ * parse a CharData section.this is the fallback function
+ * of xmlParseCharData() when the parsing requires handling
+ * of non-ASCII characters.
+ */
 void
 xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
     xmlChar buf[XML_PARSER_BIG_BUFFER_SIZE + 5];
@@ -10815,7 +10833,7 @@
 
 /**
  * xmlSetEntityReferenceFunc:
- * @func : A valid function
+ * @func: A valid function
  *
  * Set the function to call call back when a xml reference has been made
  */
diff --git a/parserInternals.c b/parserInternals.c
index e74801f..b4e7d11 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -412,20 +412,6 @@
     return(((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || ((c) == 0x0D));
 }
 
-/**
- * xmlIsBaseChar:
- * @c:  an unicode character (int)
- *
- * Check whether the character is allowed by the production
- * [85] BaseChar ::= ... long list see REC ...
- *
- * VI is your friend !
- * :1,$ s/\[#x\([0-9A-Z]*\)-#x\([0-9A-Z]*\)\]/     (((c) >= 0x\1) \&\& ((c) <= 0x\2)) ||/
- * and 
- * :1,$ s/#x\([0-9A-Z]*\)/     ((c) == 0x\1) ||/
- *
- * Returns 0 if not, non-zero otherwise
- */
 static int xmlBaseArray[] = {
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0000 - 0x000F */
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0010 - 0x001F */
@@ -445,6 +431,20 @@
   1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00F0 - 0x00FF */
 };
 
+/**
+ * xmlIsBaseChar:
+ * @c:  an unicode character (int)
+ *
+ * Check whether the character is allowed by the production
+ * [85] BaseChar ::= ... long list see REC ...
+ *
+ * VI is your friend !
+ * :1,$ s/\[#x\([0-9A-Z]*\)-#x\([0-9A-Z]*\)\]/     (((c) >= 0x\1) \&\& ((c) <= 0x\2)) ||/
+ * and 
+ * :1,$ s/#x\([0-9A-Z]*\)/     ((c) == 0x\1) ||/
+ *
+ * Returns 0 if not, non-zero otherwise
+ */
 int
 xmlIsBaseChar(int c) {
     return(
@@ -891,6 +891,7 @@
 #ifdef DEBUG_INPUT
 #define CHECK_BUFFER(in) check_buffer(in)
 
+static
 void check_buffer(xmlParserInputPtr in) {
     if (in->base != in->buf->buffer->content) {
         xmlGenericError(xmlGenericErrorContext,
@@ -2383,7 +2384,7 @@
 
 /**
  * xmlParserFindNodeInfo:
- * @ctxt:  an XML parser context
+ * @ctx:  an XML parser context
  * @node:  an XML node within the tree
  *
  * Find the parser node info struct for a given node
diff --git a/testC14N.c b/testC14N.c
index 099707d..6094bee 100644
--- a/testC14N.c
+++ b/testC14N.c
@@ -179,7 +179,8 @@
     }									\
 }
 
-xmlChar **parse_list(xmlChar *str) {
+static xmlChar **
+parse_list(xmlChar *str) {
     xmlChar **buffer;
     xmlChar **out = NULL;
     int buffer_size = 0;
@@ -221,7 +222,7 @@
     return buffer;
 }
 
-xmlXPathObjectPtr
+static xmlXPathObjectPtr
 load_xpath_expr (xmlDocPtr parent_doc, const char* filename) {
     xmlXPathObjectPtr xpath; 
     xmlDocPtr doc;
@@ -312,7 +313,7 @@
     return(xpath);
 }
 
-void
+static void
 print_xpath_nodes(xmlNodeSetPtr nodes) {
     xmlNodePtr cur;
     int i;
diff --git a/testDocbook.c b/testDocbook.c
index 5f697cd..9ba83c6 100644
--- a/testDocbook.c
+++ b/testDocbook.c
@@ -97,7 +97,7 @@
  * Returns 1 if true
  */
 static int
-isStandaloneDebug(void *ctx ATTRIBUTE_UNUSED)
+isStandaloneDebug(void *ctxt ATTRIBUTE_UNUSED)
 {
     fprintf(stdout, "SAX.isStandalone()\n");
     return(0);
@@ -112,7 +112,7 @@
  * Returns 1 if true
  */
 static int
-hasInternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED)
+hasInternalSubsetDebug(void *ctxt ATTRIBUTE_UNUSED)
 {
     fprintf(stdout, "SAX.hasInternalSubset()\n");
     return(0);
@@ -127,20 +127,20 @@
  * Returns 1 if true
  */
 static int
-hasExternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED)
+hasExternalSubsetDebug(void *ctxt ATTRIBUTE_UNUSED)
 {
     fprintf(stdout, "SAX.hasExternalSubset()\n");
     return(0);
 }
 
 /**
- * hasInternalSubsetDebug:
+ * internalSubsetDebug:
  * @ctxt:  An XML parser context
  *
  * Does this document has an internal subset
  */
 static void
-internalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
+internalSubsetDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *name,
 	       const xmlChar *ExternalID, const xmlChar *SystemID)
 {
     fprintf(stdout, "SAX.internalSubset(%s,", name);
@@ -169,7 +169,7 @@
  * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
  */
 static xmlParserInputPtr
-resolveEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *publicId, const xmlChar *systemId)
+resolveEntityDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *publicId, const xmlChar *systemId)
 {
     /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
 
@@ -201,7 +201,7 @@
  * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
  */
 static xmlEntityPtr
-getEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
+getEntityDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *name)
 {
     fprintf(stdout, "SAX.getEntity(%s)\n", name);
     return(NULL);
@@ -217,7 +217,7 @@
  * Returns the xmlParserInputPtr
  */
 static xmlEntityPtr
-getParameterEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
+getParameterEntityDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *name)
 {
     fprintf(stdout, "SAX.getParameterEntity(%s)\n", name);
     return(NULL);
@@ -236,7 +236,7 @@
  * An entity definition has been parsed
  */
 static void
-entityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type,
+entityDeclDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *name, int type,
           const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
 {
     fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
@@ -252,7 +252,7 @@
  * An attribute definition has been parsed
  */
 static void
-attributeDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *elem,
+attributeDeclDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *elem,
 	           const xmlChar *name, int type, int def,
 		   const xmlChar *defaultValue,
 	           xmlEnumerationPtr tree ATTRIBUTE_UNUSED)
@@ -271,7 +271,7 @@
  * An element definition has been parsed
  */
 static void
-elementDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type,
+elementDeclDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *name, int type,
 	         xmlElementContentPtr content ATTRIBUTE_UNUSED)
 {
     fprintf(stdout, "SAX.elementDecl(%s, %d, ...)\n",
@@ -288,7 +288,7 @@
  * What to do when a notation declaration has been parsed.
  */
 static void
-notationDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
+notationDeclDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *name,
 	     const xmlChar *publicId, const xmlChar *systemId)
 {
     fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n",
@@ -306,7 +306,7 @@
  * What to do when an unparsed entity declaration is parsed
  */
 static void
-unparsedEntityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
+unparsedEntityDeclDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *name,
 		   const xmlChar *publicId, const xmlChar *systemId,
 		   const xmlChar *notationName)
 {
@@ -324,7 +324,7 @@
  * Everything is available on the context, so this is useless in our case.
  */
 static void
-setDocumentLocatorDebug(void *ctx ATTRIBUTE_UNUSED,
+setDocumentLocatorDebug(void *ctxt ATTRIBUTE_UNUSED,
 	                xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
 {
     fprintf(stdout, "SAX.setDocumentLocator()\n");
@@ -337,7 +337,7 @@
  * called when the document start being processed.
  */
 static void
-startDocumentDebug(void *ctx ATTRIBUTE_UNUSED)
+startDocumentDebug(void *ctxt ATTRIBUTE_UNUSED)
 {
     fprintf(stdout, "SAX.startDocument()\n");
 }
@@ -349,7 +349,7 @@
  * called when the document end has been detected.
  */
 static void
-endDocumentDebug(void *ctx ATTRIBUTE_UNUSED)
+endDocumentDebug(void *ctxt ATTRIBUTE_UNUSED)
 {
     fprintf(stdout, "SAX.endDocument()\n");
 }
@@ -362,7 +362,7 @@
  * called when an opening tag has been processed.
  */
 static void
-startElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts)
+startElementDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts)
 {
     int i;
 
@@ -396,7 +396,7 @@
  * called when the end of an element has been detected.
  */
 static void
-endElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
+endElementDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *name)
 {
     fprintf(stdout, "SAX.endElement(%s)\n", (char *) name);
 }
@@ -411,7 +411,7 @@
  * Question: how much at a time ???
  */
 static void
-charactersDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
+charactersDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
 {
     unsigned char output[40];
     int inlen = len, outlen = 30;
@@ -430,7 +430,7 @@
  * called when an entity reference is detected. 
  */
 static void
-referenceDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
+referenceDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *name)
 {
     fprintf(stdout, "SAX.reference(%s)\n", name);
 }
@@ -446,7 +446,7 @@
  * Question: how much at a time ???
  */
 static void
-ignorableWhitespaceDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
+ignorableWhitespaceDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
 {
     char output[40];
     int i;
@@ -468,7 +468,7 @@
  * A processing instruction has been parsed.
  */
 static void
-processingInstructionDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *target,
+processingInstructionDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *target,
                       const xmlChar *data)
 {
     fprintf(stdout, "SAX.processingInstruction(%s, %s)\n",
@@ -483,7 +483,7 @@
  * A comment has been parsed.
  */
 static void
-commentDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value)
+commentDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *value)
 {
     fprintf(stdout, "SAX.comment(%s)\n", value);
 }
@@ -497,7 +497,7 @@
  * called when a pcdata block has been parsed
  */
 static void
-cdataBlockDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value, int len)
+cdataBlockDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *value, int len)
 {
     fprintf(stdout, "SAX.pcdata(%.20s, %d)\n",
 	    (char *) value, len);
@@ -510,7 +510,7 @@
  * Does this document has an external subset
  */
 static void
-externalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
+externalSubsetDebug(void *ctxt ATTRIBUTE_UNUSED, const xmlChar *name,
 	       const xmlChar *ExternalID, const xmlChar *SystemID)
 {
     fprintf(stdout, "SAX.externalSubset(%s,", name);
@@ -534,7 +534,7 @@
  * extra parameters.
  */
 static void
-warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
+warningDebug(void *ctxt ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
 
@@ -554,7 +554,7 @@
  * extra parameters.
  */
 static void
-errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
+errorDebug(void *ctxt ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
 
@@ -574,7 +574,7 @@
  * extra parameters.
  */
 static void
-fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
+fatalErrorDebug(void *ctxt ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
 
diff --git a/threads.c b/threads.c
index bd99efd..6aa5ecc 100644
--- a/threads.c
+++ b/threads.c
@@ -102,7 +102,7 @@
 static void xmlOnceInit(void);
 
 /**
- * xmlMutexPtr:
+ * xmlNewMutex:
  *
  * xmlNewMutex() is used to allocate a libxml2 token struct for use in
  * synchronizing access to data.
@@ -176,7 +176,7 @@
 }
 
 /**
- * xmlRNewMutex:
+ * xmlNewRMutex:
  *
  * xmlRNewMutex() is used to allocate a reentrant mutex for use in
  * synchronizing access to data. token_r is a re-entrant lock and thus useful
@@ -204,7 +204,7 @@
 }
 
 /**
- * xmlRFreeMutex:
+ * xmlFreeRMutex:
  * @tok:  the reentrant mutex
  *
  * xmlRFreeMutex() is used to reclaim resources associated with a
@@ -322,14 +322,6 @@
 #endif /* LIBXML_THREAD_ENABLED */
 
 
-/**
- * xmlGetGlobalState:
- *
- * xmlGetGlobalState() is called to retrieve the global state for a thread.
- *
- * Returns the thread global state or NULL in case of error
- */
-
 #ifdef HAVE_WIN32_THREADS
 #if !defined(HAVE_COMPILER_TLS)
 typedef struct _xmlGlobalStateCleanupHelperParams
@@ -338,7 +330,7 @@
     void *memory;
 } xmlGlobalStateCleanupHelperParams;
 
-void xmlGlobalStateCleanupHelper (void *p)
+static void xmlGlobalStateCleanupHelper (void *p)
 {
     xmlGlobalStateCleanupHelperParams *params = (xmlGlobalStateCleanupHelperParams *) p;
     WaitForSingleObject(params->thread, INFINITE);
@@ -350,6 +342,13 @@
 #endif /* HAVE_COMPILER_TLS */
 #endif /* HAVE_WIN32_THREADS */
 
+/**
+ * xmlGetGlobalState:
+ *
+ * xmlGetGlobalState() is called to retrieve the global state for a thread.
+ *
+ * Returns the thread global state or NULL in case of error
+ */
 xmlGlobalStatePtr
 xmlGetGlobalState(void)
 {
diff --git a/tree.c b/tree.c
index cf50bce..60ae931 100644
--- a/tree.c
+++ b/tree.c
@@ -2589,7 +2589,9 @@
 	    if ((cur->children != NULL) &&
 		(cur->type != XML_ENTITY_REF_NODE))
 		xmlFreeNodeList(cur->children);
-	    if ((cur->type == XML_ELEMENT_NODE) &&
+	    if (((cur->type == XML_ELEMENT_NODE) ||
+		 (cur->type == XML_XINCLUDE_START) ||
+		 (cur->type == XML_XINCLUDE_END)) &&
 		(cur->properties != NULL))
 		xmlFreePropList(cur->properties);
 	    if ((cur->type != XML_ELEMENT_NODE) &&
@@ -2667,7 +2669,10 @@
     if ((cur->children != NULL) &&
 	(cur->type != XML_ENTITY_REF_NODE))
 	xmlFreeNodeList(cur->children);
-    if ((cur->type == XML_ELEMENT_NODE) && (cur->properties != NULL))
+    if (((cur->type == XML_ELEMENT_NODE) ||
+	 (cur->type == XML_XINCLUDE_START) ||
+	 (cur->type == XML_XINCLUDE_END)) &&
+	(cur->properties != NULL))
 	xmlFreePropList(cur->properties);
     if ((cur->type != XML_ELEMENT_NODE) &&
 	(cur->content != NULL) &&
@@ -3407,7 +3412,7 @@
  
 /**
  * xmlGetLineNo:
- * @node : valid node
+ * @node: valid node
  *
  * Get line number of node. this requires activation of this option
  * before invoking the parser by calling xmlLineNumbersDefault(1)
@@ -4695,7 +4700,7 @@
 }
 
 /**
- * xmlNewReconciliedNs
+ * xmlNewReconciliedNs:
  * @doc:  the document
  * @tree:  a node expected to hold the new namespace
  * @ns:  the original namespace
@@ -4761,7 +4766,7 @@
 }
 
 /**
- * xmlReconciliateNs
+ * xmlReconciliateNs:
  * @doc:  the document
  * @tree:  a node defining the subtree to reconciliate
  *
@@ -7459,7 +7464,7 @@
 }
 
 /**
- * xmlSaveFormatFileEnc
+ * xmlSaveFormatFileEnc:
  * @filename:  the filename or URL to output
  * @cur:  the document being saved
  * @encoding:  the name of the encoding to use or NULL.
diff --git a/valid.c b/valid.c
index 75121a8..7f18a6f 100644
--- a/valid.c
+++ b/valid.c
@@ -699,7 +699,7 @@
 
 /**
  * xmlCopyElementContent:
- * @content:  An element content pointer.
+ * @cur:  An element content pointer.
  *
  * Build a copy of an element content description.
  * 
@@ -2226,7 +2226,7 @@
 }
 
 /**
- * xmlRemoveID
+ * xmlRemoveID:
  * @doc:  the document
  * @attr:  the attribute
  *
@@ -2507,7 +2507,7 @@
 }
 
 /**
- * xmlRemoveRef
+ * xmlRemoveRef:
  * @doc:  the document
  * @attr:  the attribute
  *
@@ -2829,7 +2829,7 @@
 }
 
 /**
- * xmlIsMixedElement
+ * xmlIsMixedElement:
  * @doc:  the document
  * @name:  the element name
  *
@@ -3367,7 +3367,6 @@
  * @elem:  the parent
  * @name:  the attribute name
  * @value:  the attribute value
- * @ctxt:  the validation context or NULL
  *
  * Does the validation related extra step of the normalization of attribute
  * values:
diff --git a/xmlIO.c b/xmlIO.c
index 1bff44a..0add823 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -135,7 +135,7 @@
 
 
 /**
- * xmlNormalizeWindowsPath
+ * xmlNormalizeWindowsPath:
  * @path:  a windows path like "C:/foo/bar"
  *
  * Normalize a Windows path to make an URL from it
diff --git a/xmllint.c b/xmllint.c
index fce097f..b5d8e0b 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -137,7 +137,7 @@
 #ifdef HAVE_SYS_TIME_H
 #ifdef HAVE_FTIME
 
-int
+static int
 my_gettimeofday(struct timeval *tvp, void *tzp)
 {
 	struct timeb timebuffer;
diff --git a/xmlmemory.c b/xmlmemory.c
index 0079f23..ba3965c 100644
--- a/xmlmemory.c
+++ b/xmlmemory.c
@@ -115,10 +115,10 @@
 static MEMHDR *memlist = NULL;
 #endif
 
-void debugmem_tag_error(void *addr);
+static void debugmem_tag_error(void *addr);
 #ifdef MEM_LIST
-void  debugmem_list_add(MEMHDR *);
-void debugmem_list_delete(MEMHDR *);
+static void  debugmem_list_add(MEMHDR *);
+static void debugmem_list_delete(MEMHDR *);
 #endif
 #define Mem_Tag_Err(a) debugmem_tag_error(a);
 
@@ -412,7 +412,7 @@
 
 /**
  * xmlMemoryStrdup:
- * @ptr:  the initial string pointer
+ * @str:  the initial string pointer
  *
  * a strdup() equivalent, with logging of the allocation info.
  *
@@ -599,7 +599,7 @@
 
 #ifdef MEM_LIST
 
-void debugmem_list_add(MEMHDR *p)
+static void debugmem_list_add(MEMHDR *p)
 {
      p->mh_next = memlist;
      p->mh_prev = NULL;
@@ -611,7 +611,7 @@
 #endif
 }
 
-void debugmem_list_delete(MEMHDR *p)
+static void debugmem_list_delete(MEMHDR *p)
 {
      if (p->mh_next)
      p->mh_next->mh_prev = p->mh_prev;
@@ -627,10 +627,12 @@
 #endif
 
 /*
- * debugmem_tag_error : internal error function.
+ * debugmem_tag_error:
+ *
+ * internal error function.
  */
  
-void debugmem_tag_error(void *p)
+static void debugmem_tag_error(void *p)
 {
      xmlGenericError(xmlGenericErrorContext,
 	     "Memory tag error occurs :%p \n\t bye\n", p);
@@ -673,6 +675,8 @@
  *								*
  ****************************************************************/
 
+static int xmlInitMemoryDone = 0;
+
 /**
  * xmlInitMemory:
  *
@@ -680,9 +684,6 @@
  *
  * Returns 0 on success
  */
-
-static int xmlInitMemoryDone = 0;
-
 int
 xmlInitMemory(void)
 {
diff --git a/xmlreader.c b/xmlreader.c
index 1215f4f..19857e7 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -571,7 +571,7 @@
 }
 
 /**
- * xmlTextReaderIsEmpty:
+ * xmlTextReaderIsEmptyElement:
  * @reader:  the xmlTextReaderPtr used
  *
  * Check if the current node is empty
diff --git a/xmlregexp.c b/xmlregexp.c
index 155a2f0..d902a11 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -2261,13 +2261,15 @@
  ************************************************************************/
 
 /**
- * xmlRegExecCtxtPtr:
+ * xmlRegNewExecCtxt:
  * @comp: a precompiled regular expression
  * @callback: a callback function used for handling progresses in the
  *            automata matching phase
  * @data: the context data associated to the callback in this context
  *
  * Build a context used for progressive evaluation of a regexp.
+ *
+ * Returns the new context
  */
 xmlRegExecCtxtPtr
 xmlRegNewExecCtxt(xmlRegexpPtr comp, xmlRegExecCallbacks callback, void *data) {
diff --git a/xmlschemas.c b/xmlschemas.c
index 773fe6e..2312bfa 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -3930,9 +3930,8 @@
 /**
  * xmlSchemaParse:
  * @ctxt:  a schema validation context
- * @URL:  the location of the schema
  *
- * Load, XML parse a schema definition resource and build an internal
+ * parse a schema definition resource and build an internal
  * XML Shema struture which can be used to validate instances.
  * *WARNING* this interface is highly subject to change
  *
@@ -4098,16 +4097,13 @@
 }
  
 /**
- * xmlSchemaParse:
+ * xmlSchemaSetParserErrors:
  * @ctxt:  a schema validation context
- * @URL:  the location of the schema
+ * @err:  the error callback
+ * @warn:  the warning callback
+ * @ctx:  contextual data for the callbacks
  *
- * Load, XML parse a schema definition resource and build an internal
- * XML Shema struture which can be used to validate instances.
- * *WARNING* this interface is highly subject to change
- *
- * Returns the internal XML Schema structure built from the resource or
- *         NULL in case of error
+ * Set the callback functions used to handle errors for a validation context
  */
 void
 xmlSchemaSetParserErrors(xmlSchemaParserCtxtPtr ctxt,
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 976b89f..1be67c8 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -1781,7 +1781,7 @@
 
 /**
  * xmlSchemaValidateFacet:
- * @type:  the type declaration
+ * @base:  the base type
  * @facet:  the facet to check
  * @value:  the lexical repr of the value to validate
  * @val:  the precomputed value
diff --git a/xpath.c b/xpath.c
index 6c68d75..fc39cf7 100644
--- a/xpath.c
+++ b/xpath.c
@@ -3805,7 +3805,7 @@
  ************************************************************************/
 
 /**
- * xmlXPathNodeStringHash:
+ * xmlXPathNodeValHash:
  * @node:  a node pointer
  *
  * Function computing the beginning of the string value of the node,
@@ -4193,7 +4193,7 @@
 }
 
 /**
- * xmlXPathEqualNodeSetString
+ * xmlXPathEqualNodeSetString:
  * @arg:  the nodeset object argument
  * @str:  the string to compare to.
  * @neq:  flag to show whether for '=' (0) or '!=' (1)
@@ -4248,7 +4248,7 @@
 }
 
 /**
- * xmlXPathEqualNodeSetFloat
+ * xmlXPathEqualNodeSetFloat:
  * @arg:  the nodeset object argument
  * @f:  the float to compare to
  * @neq:  flag to show whether to compare '=' (0) or '!=' (1)
@@ -4304,7 +4304,7 @@
 
 
 /**
- * xmlXPathEqualNodeSets
+ * xmlXPathEqualNodeSets:
  * @arg1:  first nodeset object argument
  * @arg2:  second nodeset object argument
  * @neq:   flag to show whether to test '=' (0) or '!=' (1)
@@ -7542,7 +7542,6 @@
 
 /**
  * xmlXPathIsNodeType:
- * @ctxt:  the XPath Parser context
  * @name:  a name string
  *
  * Is the name given a NodeType one.