started integrating the non-controversial parts of Gary Pennington

* HTMLtree.c catalog.c debugXML.c entities.c nanoftp.c
  parser.c valid.c xmlmemory.c xpath.c xpointer.c: started
  integrating the non-controversial parts of Gary Pennington
  multithread patches
* catalog.c: corrected a small bug introduced
Daniel
diff --git a/ChangeLog b/ChangeLog
index af75256..b73c0f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Oct 12 00:53:03 CEST 2001 Daniel Veillard <daniel@veillard.com>
+
+	* HTMLtree.c catalog.c debugXML.c entities.c nanoftp.c
+	  parser.c valid.c xmlmemory.c xpath.c xpointer.c: started
+	  integrating the non-controversial parts of Gary Pennington
+	  multithread patches
+	* catalog.c: corrected a small bug introduced
+
 Thu Oct 11 20:58:15 CEST 2001 Daniel Veillard <daniel@veillard.com>
 
 	* catalog.c include/libxml/catalog.h: very serious cleanup,
diff --git a/HTMLtree.c b/HTMLtree.c
index cc61ef9..030dce6 100644
--- a/HTMLtree.c
+++ b/HTMLtree.c
@@ -451,8 +451,8 @@
     }
     if (cur->type == HTML_TEXT_NODE) {
 	if (cur->content != NULL) {
-	    if (((cur->name == xmlStringText) ||
-		 (cur->name != xmlStringTextNoenc)) &&
+	    if (((cur->name == (const xmlChar *)xmlStringText) ||
+		 (cur->name != (const xmlChar *)xmlStringTextNoenc)) &&
 		((cur->parent == NULL) ||
 		 (!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) {
 		xmlChar *buffer;
@@ -949,8 +949,8 @@
     }
     if (cur->type == HTML_TEXT_NODE) {
 	if (cur->content != NULL) {
-	    if (((cur->name == xmlStringText) ||
-		 (cur->name != xmlStringTextNoenc)) &&
+	    if (((cur->name == (const xmlChar *)xmlStringText) ||
+		 (cur->name != (const xmlChar *)xmlStringTextNoenc)) &&
 		((cur->parent == NULL) ||
 		 (!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) {
 		xmlChar *buffer;
diff --git a/catalog.c b/catalog.c
index 1b7bd8d..ef8a0c7 100644
--- a/catalog.c
+++ b/catalog.c
@@ -2607,7 +2607,7 @@
     if ((URI == NULL) || (catal == NULL))
 	return(NULL);
 
-    if (catal->type == XML_XML_CATALOG_TYPE)
+    if (xmlDebugCatalogs)
 	xmlGenericError(xmlGenericErrorContext,
 		"Resolve URI %s\n", URI);
 
@@ -2734,7 +2734,7 @@
 	const char *catalogs;
 	xmlCatalogPtr catal;
 
-	catalogs = getenv("XML_CATALOG_FILES");
+	catalogs = (const char *) getenv("XML_CATALOG_FILES");
 	if (catalogs == NULL)
 	    catalogs = XML_XML_DEFAULT_CATALOG;
 
diff --git a/debugXML.c b/debugXML.c
index 6c7d9a4..dbdd1f3 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -567,7 +567,7 @@
             break;
         case XML_TEXT_NODE:
             fprintf(output, shift);
-	    if (node->name == xmlStringTextNoenc)
+	    if (node->name == (const xmlChar *) xmlStringTextNoenc)
 		fprintf(output, "TEXT no enc\n");
 	    else
 		fprintf(output, "TEXT\n");
diff --git a/entities.c b/entities.c
index a230666..09f46d3 100644
--- a/entities.c
+++ b/entities.c
@@ -38,7 +38,7 @@
  * TODO: This is GROSS, allocation of a 256 entry hash for
  *       a fixed number of 4 elements !
  */
-xmlHashTablePtr xmlPredefinedEntities = NULL;
+static xmlHashTablePtr xmlPredefinedEntities = NULL;
 
 /*
  * xmlFreeEntity : clean-up an entity record.
diff --git a/nanoftp.c b/nanoftp.c
index 1080e6d..1d078fd 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -74,8 +74,6 @@
 #define SOCKET int
 #endif
 
-static char hostname[100];
-
 #define FTP_COMMAND_OK		200
 #define FTP_SYNTAX_ERROR	500
 #define FTP_GET_PASSWD		331
@@ -99,6 +97,7 @@
     int controlBufIndex;
     int controlBufUsed;
     int controlBufAnswer;
+    char localhostname[100];
 } xmlNanoFTPCtxt, *xmlNanoFTPCtxtPtr;
 
 static int initialized = 0;
@@ -131,8 +130,6 @@
 	return;
 #endif
 
-    gethostname(hostname, sizeof(hostname));
-
     proxyPort = 21;
     env = getenv("no_proxy");
     if (env != NULL)
@@ -177,7 +174,6 @@
 	xmlFree(proxyPasswd);
 	proxyPasswd = NULL;
     }
-    hostname[0] = 0;
 #ifdef _WINSOCKAPI_
     if (initialized)
 	WSACleanup();
@@ -480,6 +476,7 @@
     ret->returnValue = 0;
     ret->controlBufIndex = 0;
     ret->controlBufUsed = 0;
+    gethostname(ret->localhostname, sizeof(ret->localhostname));
 
     if (URL != NULL)
 	xmlNanoFTPScanURL(ret, URL);
@@ -778,7 +775,7 @@
     int res;
 
     if (ctxt->passwd == NULL)
-	snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", hostname);
+	snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", ctxt->localhostname);
     else
 	snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
     buf[sizeof(buf) - 1] = 0;
@@ -951,7 +948,7 @@
 			snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
 		    else
 			snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n",
-			               hostname);
+			               ctxt->localhostname);
                     buf[sizeof(buf) - 1] = 0;
                     len = strlen(buf);
 #ifdef DEBUG_FTP
@@ -1040,7 +1037,8 @@
 		    return(0);
 		}    
 		if (ctxt->passwd == NULL)
-		    snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", hostname);
+		    snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", 
+			     ctxt->localhostname);
 		else
 		    snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
                 buf[sizeof(buf) - 1] = 0;
diff --git a/parser.c b/parser.c
index c52529b..31eb8ff 100644
--- a/parser.c
+++ b/parser.c
@@ -86,7 +86,7 @@
  * List of XML prefixed PI allowed by W3C specs
  */
 
-const char *xmlW3CPIs[] = {
+static const char *xmlW3CPIs[] = {
     "xml-stylesheet",
     NULL
 };
@@ -1187,7 +1187,7 @@
     return 0;
 }
 
-static xmlChar casemap[256] = {
+static const xmlChar casemap[256] = {
     0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
     0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
     0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
diff --git a/valid.c b/valid.c
index 723ada4..c27c3c2 100644
--- a/valid.c
+++ b/valid.c
@@ -70,7 +70,7 @@
 }									\
 
 /*
- * I will use a home made algorithm less complex and easier to
+ * I use a home made algorithm less complex and easier to
  * debug/maintin than a generic NFA -> DFA state based algo. The
  * only restriction is on the deepness of the tree limited by the
  * size of the occurs bitfield
@@ -81,7 +81,7 @@
 #define ROLLBACK_OR	0
 #define ROLLBACK_PARENT	1
 
-struct _xmlValidState {
+typedef struct _xmlValidState {
     xmlElementContentPtr cont;	/* pointer to the content model subtree */
     xmlNodePtr           node;	/* pointer to the current node in the list */
     long                 occurs;/* bitfield for multiple occurences */
diff --git a/xmlmemory.c b/xmlmemory.c
index ba74caf..f689236 100644
--- a/xmlmemory.c
+++ b/xmlmemory.c
@@ -94,9 +94,9 @@
 static unsigned long  debugMemSize = 0;
 static unsigned long  debugMaxMemSize = 0;
 static int block=0;
-int xmlMemStopAtBlock = 0;
-void *xmlMemTraceBlockAt = NULL;
-int xmlMemInitialized = 0;
+static int xmlMemStopAtBlock = 0;
+static void *xmlMemTraceBlockAt = NULL;
+static int xmlMemInitialized = 0;
 #ifdef MEM_LIST
 static MEMHDR *memlist = NULL;
 #endif
@@ -625,7 +625,7 @@
 #endif
 }
 
-FILE *xmlMemoryDumpFile = NULL;
+static FILE *xmlMemoryDumpFile = NULL;
 
 
 /**
diff --git a/xpath.c b/xpath.c
index 3283283..b63f8b7 100644
--- a/xpath.c
+++ b/xpath.c
@@ -1176,7 +1176,7 @@
  ************************************************************************/
 
 
-const char *xmlXPathErrorMessages[] = {
+static const char *xmlXPathErrorMessages[] = {
     "Ok",
     "Number encoding",
     "Unfinished litteral",
@@ -3830,7 +3830,6 @@
 	    return(xmlXPathCompareValues(ctxt, inf, strict));
 	default:
 	    TODO
-	    return(0);
     }
     return(0);
 }
@@ -9280,7 +9279,6 @@
                                         "xmlXPathRunEval: function %s not found\n",
                                         op->value4);
                         XP_ERROR0(XPATH_UNKNOWN_FUNC_ERROR);
-                        return (total);
                     }
                     op->cache = (void *) func;
                     op->cacheURI = (void *) URI;
diff --git a/xpointer.c b/xpointer.c
index 7764578..692ea71 100644
--- a/xpointer.c
+++ b/xpointer.c
@@ -2027,7 +2027,7 @@
 					   xmlXPtrGetArity(node)));
 		}
 		default:
-		    return(NULL);
+		    break;
 	    }
 	    return(NULL);
 	}
@@ -2064,7 +2064,7 @@
 					       xmlXPtrGetArity(node)));
 		    }
 		    default:
-			return(NULL);
+			break;
 		}
 		return(NULL);
 	    }
@@ -2629,7 +2629,7 @@
 		*indx = obj->index;
 	    return(0);
 	default:
-	    return(-1);
+	    break;
     }
     return(-1);
 }
@@ -2665,7 +2665,7 @@
 		*indx = obj->index;
 	    return(0);
 	default:
-	    return(-1);
+	    break;
     }
     return(-1);
 }