[xml] threading work



Hi,

I've done enough work to be able to get libxml2 to behave well in terms of the TSD part of the thread-safe reworking.

Daniel asked me to submit diffs to the list and also any new files which are required, so here goes. Be warned, this code is rough and needs a lot of polishing. There are some comments...

NB: All the development has been done against 2.4.5 which was the latest stable release when I started doing this.

Okay, the attachments contain the following:

Changed files.

xml_thread.diff - This is a diff between the 2.4.5 source and the source I've modified. Most of the changes reflect work to add support for threading, but there are some changes which were to stop the compiler emitting warnings whilst I was making the changes to support threading.

xml_thread_h.diff - Header file changes.

New Files

global_function.c and global_functions.h - These files are generated automatically from a script which I have hacked together. (I haven't submitted the script since I don't think it's very interesting). Basically these functions implement the code required to use TSD to make libxml2 clients think that they are manipulating global variables when really they are manipulating TSD variables. If you understand one function, you understand them all since they just do the same thing with different variable names and data types.

global_utils.h and global_utils.c - These files contain utilities to support the TSD work and various other useful threading utilities. Also, and this is important, all the global declarations which have been superceded but TSD have been moved into the global_utils.c file to keep them out of the way from the rest of the code. This is a temporary home and they may/should be moved into a separate file at some point.

Sample Files

xml_test.c - A simple non-threaded program to make sure non-threaded clients work with the library
new_xml_test_mt.c - A threaded client which tests the library.

Ok, that's it for now.

Gary

--
Gary Pennington
Solaris Kernel Development,
Sun Microsystems
Gary Pennington sun com

diff -c libxml2-2.4.5/HTMLtree.c ../libxml2-2.4.5/HTMLtree.c
*** libxml2-2.4.5/HTMLtree.c    Fri Aug 17 03:35:06 2001
--- ../libxml2-2.4.5/HTMLtree.c Fri Oct  5 15:31:15 2001
***************
*** 451,458 ****
      }
      if (cur->type == HTML_TEXT_NODE) {
        if (cur->content != NULL) {
!           if (((cur->name == xmlStringText) ||
!                (cur->name != xmlStringTextNoenc)) &&
                ((cur->parent == NULL) ||
                 (!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) {
                xmlChar *buffer;
--- 451,458 ----
      }
      if (cur->type == HTML_TEXT_NODE) {
        if (cur->content != NULL) {
!           if (((cur->name == (const xmlChar *)xmlStringText) ||
!                (cur->name != (const xmlChar *)xmlStringTextNoenc)) &&
                ((cur->parent == NULL) ||
                 (!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) {
                xmlChar *buffer;
***************
*** 949,956 ****
      }
      if (cur->type == HTML_TEXT_NODE) {
        if (cur->content != NULL) {
!           if (((cur->name == xmlStringText) ||
!                (cur->name != xmlStringTextNoenc)) &&
                ((cur->parent == NULL) ||
                 (!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) {
                xmlChar *buffer;
--- 949,956 ----
      }
      if (cur->type == HTML_TEXT_NODE) {
        if (cur->content != NULL) {
!           if (((cur->name == (const xmlChar *)xmlStringText) ||
!                (cur->name != (const xmlChar *)xmlStringTextNoenc)) &&
                ((cur->parent == NULL) ||
                 (!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) {
                xmlChar *buffer;
diff -c libxml2-2.4.5/Makefile ../libxml2-2.4.5/Makefile
*** libxml2-2.4.5/Makefile      Thu Oct 11 10:55:56 2001
--- ../libxml2-2.4.5/Makefile   Thu Oct 11 09:53:20 2001
***************
*** 64,70 ****
  AS = @AS@
  CATALOG_OBJ = catalog.o
  CC = cc
! CFLAGS = 
  CPP = cc -E
  DEBUG_OBJ = debugXML.o
  DLLTOOL = @DLLTOOL@
--- 64,71 ----
  AS = @AS@
  CATALOG_OBJ = catalog.o
  CC = cc
! CFLAGS = -mt -g -DSOLARIS
! CFLAGS += -errwarn=%all -errtags=yes
  CPP = cc -E
  DEBUG_OBJ = debugXML.o
  DLLTOOL = @DLLTOOL@
***************
*** 87,93 ****
  LIBXML_VERSION_NUMBER = 20405
  LN_S = ln -s
  MAINT = #
! MAKEINFO = /home/garyp/LIB_XML_BUILD/TEMP/libxml2-2.4.5/missing makeinfo
  MV = /usr/bin/mv
  M_LIBS = 
  OBJDUMP = @OBJDUMP@
--- 88,94 ----
  LIBXML_VERSION_NUMBER = 20405
  LN_S = ln -s
  MAINT = #
! MAKEINFO = /home/garyp/LIB_XML_BUILD/libxml2-2.4.5/missing makeinfo
  MV = /usr/bin/mv
  M_LIBS = 
  OBJDUMP = @OBJDUMP@
***************
*** 140,146 ****
  libxml2_la_LDFLAGS = -version-info 6:5:4
  
  #libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c           parser.c tree.c 
hash.c list.c xmlIO.c xmlmemory.c uri.c                 valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c 
xpath.c              xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c                 catalog.c 
strio.c trio.c
! libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c            parser.c tree.c 
hash.c list.c xmlIO.c xmlmemory.c uri.c                 valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c 
xpath.c              xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c                 catalog.c 
  
  DEPS = $(top_builddir)/libxml2.la
  LDADDS = $(top_builddir)/libxml2.la -lz $(ICONV_LIBS) -lm
--- 141,147 ----
  libxml2_la_LDFLAGS = -version-info 6:5:4
  
  #libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c           parser.c tree.c 
hash.c list.c xmlIO.c xmlmemory.c uri.c                 valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c 
xpath.c              xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c                 catalog.c 
strio.c trio.c
! libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c            parser.c tree.c 
hash.c list.c xmlIO.c xmlmemory.c uri.c                 valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c 
xpath.c              xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c                 catalog.c  
global_utils.c global_functions.c
  
  DEPS = $(top_builddir)/libxml2.la
  LDADDS = $(top_builddir)/libxml2.la -lz $(ICONV_LIBS) -lm
***************
*** 212,218 ****
  xmlmemory.lo uri.lo valid.lo xlink.lo \
  HTMLparser.lo HTMLtree.lo debugXML.lo xpath.lo \
  xpointer.lo xinclude.lo nanohttp.lo nanoftp.lo \
! DOCBparser.lo catalog.lo
  #libxml2_la_OBJECTS =  SAX.lo entities.lo \
  #encoding.lo error.lo parserInternals.lo \
  #parser.lo tree.lo hash.lo list.lo xmlIO.lo \
--- 213,219 ----
  xmlmemory.lo uri.lo valid.lo xlink.lo \
  HTMLparser.lo HTMLtree.lo debugXML.lo xpath.lo \
  xpointer.lo xinclude.lo nanohttp.lo nanoftp.lo \
! DOCBparser.lo catalog.lo global_utils.lo global_functions.lo
  #libxml2_la_OBJECTS =  SAX.lo entities.lo \
  #encoding.lo error.lo parserInternals.lo \
  #parser.lo tree.lo hash.lo list.lo xmlIO.lo \
diff -c libxml2-2.4.5/SAX.c ../libxml2-2.4.5/SAX.c
*** libxml2-2.4.5/SAX.c Tue Sep 11 03:35:05 2001
--- ../libxml2-2.4.5/SAX.c      Thu Oct 11 16:53:10 2001
***************
*** 88,101 ****
      return(ctxt->input->col);
  }
  
- /*
-  * The default SAX Locator.
-  */
- 
- xmlSAXLocator xmlDefaultSAXLocator = {
-     getPublicId, getSystemId, getLineNumber, getColumnNumber
- };
- 
  /**
   * isStandalone:
   * @ctx: the user data (XML parser context)
--- 88,93 ----
***************
*** 1667,1705 ****
      }
  }
  
- /*
-  * Default handler for XML, builds the DOM tree
-  */
- xmlSAXHandler xmlDefaultSAXHandler = {
-     internalSubset,
-     isStandalone,
-     hasInternalSubset,
-     hasExternalSubset,
-     resolveEntity,
-     getEntity,
-     entityDecl,
-     notationDecl,
-     attributeDecl,
-     elementDecl,
-     unparsedEntityDecl,
-     setDocumentLocator,
-     startDocument,
-     endDocument,
-     startElement,
-     endElement,
-     reference,
-     characters,
-     characters,
-     processingInstruction,
-     comment,
-     xmlParserWarning,
-     xmlParserError,
-     xmlParserError,
-     getParameterEntity,
-     cdataBlock,
-     externalSubset,
- };
- 
  /**
   * xmlDefaultSAXHandlerInit:
   *
--- 1659,1664 ----
***************
*** 1706,1785 ****
   * Initialize the default SAX handler
   */
  void
! xmlDefaultSAXHandlerInit(void)
  {
!     static int xmlSAXInitialized = 0;
!     if (xmlSAXInitialized)
        return;
  
!     xmlDefaultSAXHandler.internalSubset = internalSubset;
!     xmlDefaultSAXHandler.externalSubset = externalSubset;
!     xmlDefaultSAXHandler.isStandalone = isStandalone;
!     xmlDefaultSAXHandler.hasInternalSubset = hasInternalSubset;
!     xmlDefaultSAXHandler.hasExternalSubset = hasExternalSubset;
!     xmlDefaultSAXHandler.resolveEntity = resolveEntity;
!     xmlDefaultSAXHandler.getEntity = getEntity;
!     xmlDefaultSAXHandler.getParameterEntity = getParameterEntity;
!     xmlDefaultSAXHandler.entityDecl = entityDecl;
!     xmlDefaultSAXHandler.attributeDecl = attributeDecl;
!     xmlDefaultSAXHandler.elementDecl = elementDecl;
!     xmlDefaultSAXHandler.notationDecl = notationDecl;
!     xmlDefaultSAXHandler.unparsedEntityDecl = unparsedEntityDecl;
!     xmlDefaultSAXHandler.setDocumentLocator = setDocumentLocator;
!     xmlDefaultSAXHandler.startDocument = startDocument;
!     xmlDefaultSAXHandler.endDocument = endDocument;
!     xmlDefaultSAXHandler.startElement = startElement;
!     xmlDefaultSAXHandler.endElement = endElement;
!     xmlDefaultSAXHandler.reference = reference;
!     xmlDefaultSAXHandler.characters = characters;
!     xmlDefaultSAXHandler.cdataBlock = cdataBlock;
!     xmlDefaultSAXHandler.ignorableWhitespace = characters;
!     xmlDefaultSAXHandler.processingInstruction = processingInstruction;
!     xmlDefaultSAXHandler.comment = comment;
!     if (xmlGetWarningsDefaultValue == 0)
!       xmlDefaultSAXHandler.warning = NULL;
      else
!       xmlDefaultSAXHandler.warning = xmlParserWarning;
!     xmlDefaultSAXHandler.error = xmlParserError;
!     xmlDefaultSAXHandler.fatalError = xmlParserError;
  
!     xmlSAXInitialized = 1;
  }
  
! #ifdef LIBXML_HTML_ENABLED
! /*
!  * Default handler for HTML, builds the DOM tree
   */
! xmlSAXHandler htmlDefaultSAXHandler = {
!     internalSubset,
!     NULL,
!     NULL,
!     NULL,
!     NULL,
!     getEntity,
!     NULL,
!     NULL,
!     NULL,
!     NULL,
!     NULL,
!     setDocumentLocator,
!     startDocument,
!     endDocument,
!     startElement,
!     endElement,
!     NULL,
!     characters,
!     ignorableWhitespace,
!     NULL,
!     comment,
!     xmlParserWarning,
!     xmlParserError,
!     xmlParserError,
!     getParameterEntity,
!     cdataBlock,
!     NULL,
! };
  
  /**
   * htmlDefaultSAXHandlerInit:
   *
--- 1665,1724 ----
   * Initialize the default SAX handler
   */
  void
! initxmlDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
  {
!       if(hdlr->initialized == 1)
        return;
  
! 
!     hdlr->internalSubset = internalSubset;
!     hdlr->externalSubset = externalSubset;
!     hdlr->isStandalone = isStandalone;
!     hdlr->hasInternalSubset = hasInternalSubset;
!     hdlr->hasExternalSubset = hasExternalSubset;
!     hdlr->resolveEntity = resolveEntity;
!     hdlr->getEntity = getEntity;
!     hdlr->getParameterEntity = getParameterEntity;
!     hdlr->entityDecl = entityDecl;
!     hdlr->attributeDecl = attributeDecl;
!     hdlr->elementDecl = elementDecl;
!     hdlr->notationDecl = notationDecl;
!     hdlr->unparsedEntityDecl = unparsedEntityDecl;
!     hdlr->setDocumentLocator = setDocumentLocator;
!     hdlr->startDocument = startDocument;
!     hdlr->endDocument = endDocument;
!     hdlr->startElement = startElement;
!     hdlr->endElement = endElement;
!     hdlr->reference = reference;
!     hdlr->characters = characters;
!     hdlr->cdataBlock = cdataBlock;
!     hdlr->ignorableWhitespace = characters;
!     hdlr->processingInstruction = processingInstruction;
!     hdlr->comment = comment;
!     /* if (xmlGetWarningsDefaultValue == 0) */
!     if (warning == 0)
!       hdlr->warning = NULL;
      else
!       hdlr->warning = xmlParserWarning;
!     hdlr->error = xmlParserError;
!     hdlr->fatalError = xmlParserError;
  
!     hdlr->initialized = 1;
  }
  
! /**
!  * xmlDefaultSAXHandlerInit:
!  *
!  * Initialize the default SAX handler
   */
! void
! xmlDefaultSAXHandlerInit(void)
! {
!       initxmlDefaultSAXHandler(&xmlDefaultSAXHandler, xmlGetWarningsDefaultValue);
! }
  
+ #ifdef LIBXML_HTML_ENABLED
+ 
  /**
   * htmlDefaultSAXHandlerInit:
   *
***************
*** 1786,1863 ****
   * Initialize the default SAX handler
   */
  void
! htmlDefaultSAXHandlerInit(void)
  {
!     static int htmlSAXInitialized = 0;
!     if (htmlSAXInitialized)
        return;
  
!     htmlDefaultSAXHandler.internalSubset = internalSubset;
!     htmlDefaultSAXHandler.externalSubset = NULL;
!     htmlDefaultSAXHandler.isStandalone = NULL;
!     htmlDefaultSAXHandler.hasInternalSubset = NULL;
!     htmlDefaultSAXHandler.hasExternalSubset = NULL;
!     htmlDefaultSAXHandler.resolveEntity = NULL;
!     htmlDefaultSAXHandler.getEntity = getEntity;
!     htmlDefaultSAXHandler.getParameterEntity = NULL;
!     htmlDefaultSAXHandler.entityDecl = NULL;
!     htmlDefaultSAXHandler.attributeDecl = NULL;
!     htmlDefaultSAXHandler.elementDecl = NULL;
!     htmlDefaultSAXHandler.notationDecl = NULL;
!     htmlDefaultSAXHandler.unparsedEntityDecl = NULL;
!     htmlDefaultSAXHandler.setDocumentLocator = setDocumentLocator;
!     htmlDefaultSAXHandler.startDocument = startDocument;
!     htmlDefaultSAXHandler.endDocument = endDocument;
!     htmlDefaultSAXHandler.startElement = startElement;
!     htmlDefaultSAXHandler.endElement = endElement;
!     htmlDefaultSAXHandler.reference = NULL;
!     htmlDefaultSAXHandler.characters = characters;
!     htmlDefaultSAXHandler.cdataBlock = cdataBlock;
!     htmlDefaultSAXHandler.ignorableWhitespace = ignorableWhitespace;
!     htmlDefaultSAXHandler.processingInstruction = NULL;
!     htmlDefaultSAXHandler.comment = comment;
!     htmlDefaultSAXHandler.warning = xmlParserWarning;
!     htmlDefaultSAXHandler.error = xmlParserError;
!     htmlDefaultSAXHandler.fatalError = xmlParserError;
  
!     htmlSAXInitialized = 1;
  }
  #endif /* LIBXML_HTML_ENABLED */
  
  #ifdef LIBXML_DOCB_ENABLED
- /*
-  * Default handler for SGML DocBook, builds the DOM tree
-  */
- xmlSAXHandler docbDefaultSAXHandler = {
-     internalSubset,
-     isStandalone,
-     hasInternalSubset,
-     hasExternalSubset,
-     resolveEntity,
-     getEntity,
-     entityDecl,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
-     setDocumentLocator,
-     startDocument,
-     endDocument,
-     startElement,
-     endElement,
-     reference,
-     characters,
-     ignorableWhitespace,
-     NULL,
-     comment,
-     xmlParserWarning,
-     xmlParserError,
-     xmlParserError,
-     getParameterEntity,
-     NULL,
-     NULL,
- };
  
  /**
   * docbDefaultSAXHandlerInit:
   *
--- 1725,1818 ----
   * Initialize the default SAX handler
   */
  void
! inithtmlDefaultSAXHandler(xmlSAXHandler *hdlr)
  {
!       if(hdlr->initialized == 1)
        return;
  
!     hdlr->internalSubset = internalSubset;
!     hdlr->externalSubset = NULL;
!     hdlr->isStandalone = NULL;
!     hdlr->hasInternalSubset = NULL;
!     hdlr->hasExternalSubset = NULL;
!     hdlr->resolveEntity = NULL;
!     hdlr->getEntity = getEntity;
!     hdlr->getParameterEntity = NULL;
!     hdlr->entityDecl = NULL;
!     hdlr->attributeDecl = NULL;
!     hdlr->elementDecl = NULL;
!     hdlr->notationDecl = NULL;
!     hdlr->unparsedEntityDecl = NULL;
!     hdlr->setDocumentLocator = setDocumentLocator;
!     hdlr->startDocument = startDocument;
!     hdlr->endDocument = endDocument;
!     hdlr->startElement = startElement;
!     hdlr->endElement = endElement;
!     hdlr->reference = NULL;
!     hdlr->characters = characters;
!     hdlr->cdataBlock = cdataBlock;
!     hdlr->ignorableWhitespace = ignorableWhitespace;
!     hdlr->processingInstruction = NULL;
!     hdlr->comment = comment;
!     hdlr->warning = xmlParserWarning;
!     hdlr->error = xmlParserError;
!     hdlr->fatalError = xmlParserError;
  
!     hdlr->initialized = 1;
  }
+ 
+ /**
+  * htmlDefaultSAXHandlerInit:
+  *
+  * Initialize the default SAX handler
+  */
+ void
+ htmlDefaultSAXHandlerInit(void)
+ {
+       inithtmlDefaultSAXHandler(&htmlDefaultSAXHandler);
+ }
+ 
  #endif /* LIBXML_HTML_ENABLED */
  
  #ifdef LIBXML_DOCB_ENABLED
  
+ void
+ initdocbDefaultSAXHandler(xmlSAXHandler *hdlr)
+ {
+       if(hdlr->initialized == 1)
+       return;
+ 
+     hdlr->internalSubset = internalSubset;
+     hdlr->externalSubset = NULL;
+     hdlr->isStandalone = isStandalone;
+     hdlr->hasInternalSubset = hasInternalSubset;
+     hdlr->hasExternalSubset = hasExternalSubset;
+     hdlr->resolveEntity = resolveEntity;
+     hdlr->getEntity = getEntity;
+     hdlr->getParameterEntity = NULL;
+     hdlr->entityDecl = entityDecl;
+     hdlr->attributeDecl = NULL;
+     hdlr->elementDecl = NULL;
+     hdlr->notationDecl = NULL;
+     hdlr->unparsedEntityDecl = NULL;
+     hdlr->setDocumentLocator = setDocumentLocator;
+     hdlr->startDocument = startDocument;
+     hdlr->endDocument = endDocument;
+     hdlr->startElement = startElement;
+     hdlr->endElement = endElement;
+     hdlr->reference = reference;
+     hdlr->characters = characters;
+     hdlr->cdataBlock = NULL;
+     hdlr->ignorableWhitespace = ignorableWhitespace;
+     hdlr->processingInstruction = NULL;
+     hdlr->comment = comment;
+     hdlr->warning = xmlParserWarning;
+     hdlr->error = xmlParserError;
+     hdlr->fatalError = xmlParserError;
+ 
+     hdlr->initialized = 1;
+ }
+ 
  /**
   * docbDefaultSAXHandlerInit:
   *
***************
*** 1866,1904 ****
  void
  docbDefaultSAXHandlerInit(void)
  {
!     static int docbSAXInitialized = 0;
!     if (docbSAXInitialized)
!       return;
! 
!     docbDefaultSAXHandler.internalSubset = internalSubset;
!     docbDefaultSAXHandler.externalSubset = NULL;
!     docbDefaultSAXHandler.isStandalone = isStandalone;
!     docbDefaultSAXHandler.hasInternalSubset = hasInternalSubset;
!     docbDefaultSAXHandler.hasExternalSubset = hasExternalSubset;
!     docbDefaultSAXHandler.resolveEntity = resolveEntity;
!     docbDefaultSAXHandler.getEntity = getEntity;
!     docbDefaultSAXHandler.getParameterEntity = NULL;
!     docbDefaultSAXHandler.entityDecl = entityDecl;
!     docbDefaultSAXHandler.attributeDecl = NULL;
!     docbDefaultSAXHandler.elementDecl = NULL;
!     docbDefaultSAXHandler.notationDecl = NULL;
!     docbDefaultSAXHandler.unparsedEntityDecl = NULL;
!     docbDefaultSAXHandler.setDocumentLocator = setDocumentLocator;
!     docbDefaultSAXHandler.startDocument = startDocument;
!     docbDefaultSAXHandler.endDocument = endDocument;
!     docbDefaultSAXHandler.startElement = startElement;
!     docbDefaultSAXHandler.endElement = endElement;
!     docbDefaultSAXHandler.reference = reference;
!     docbDefaultSAXHandler.characters = characters;
!     docbDefaultSAXHandler.cdataBlock = NULL;
!     docbDefaultSAXHandler.ignorableWhitespace = ignorableWhitespace;
!     docbDefaultSAXHandler.processingInstruction = NULL;
!     docbDefaultSAXHandler.comment = comment;
!     docbDefaultSAXHandler.warning = xmlParserWarning;
!     docbDefaultSAXHandler.error = xmlParserError;
!     docbDefaultSAXHandler.fatalError = xmlParserError;
! 
!     docbSAXInitialized = 1;
  }
  
  #endif /* LIBXML_DOCB_ENABLED */
--- 1821,1827 ----
  void
  docbDefaultSAXHandlerInit(void)
  {
!       initdocbDefaultSAXHandler(&docbDefaultSAXHandler);
  }
  
  #endif /* LIBXML_DOCB_ENABLED */
Common subdirectories: libxml2-2.4.5/SAXresult and ../libxml2-2.4.5/SAXresult
Only in ../libxml2-2.4.5: build_glob.py
diff -c libxml2-2.4.5/catalog.c ../libxml2-2.4.5/catalog.c
*** libxml2-2.4.5/catalog.c     Sun Sep  2 03:35:10 2001
--- ../libxml2-2.4.5/catalog.c  Tue Oct  9 16:39:38 2001
***************
*** 1991,1997 ****
      if (getenv("XML_DEBUG_CATALOG")) 
        xmlDebugCatalogs = 1;
      if ((xmlDefaultXMLCatalogList == NULL) && (xmlDefaultCatalog == NULL)) {
!       catalogs = getenv("XML_CATALOG_FILES");
        if (catalogs == NULL)
            catalogs = XML_DEFAULT_CATALOG;
        xmlDefaultXMLCatalogList = xmlNewCatalogEntry(XML_CATA_CATALOG,
--- 1991,1997 ----
      if (getenv("XML_DEBUG_CATALOG")) 
        xmlDebugCatalogs = 1;
      if ((xmlDefaultXMLCatalogList == NULL) && (xmlDefaultCatalog == NULL)) {
!       catalogs = (const char *)getenv("XML_CATALOG_FILES");
        if (catalogs == NULL)
            catalogs = XML_DEFAULT_CATALOG;
        xmlDefaultXMLCatalogList = xmlNewCatalogEntry(XML_CATA_CATALOG,
diff -c libxml2-2.4.5/config.log ../libxml2-2.4.5/config.log
*** libxml2-2.4.5/config.log    Thu Oct 11 10:55:54 2001
--- ../libxml2-2.4.5/config.log Wed Sep 19 16:47:32 2001
***************
*** 24,34 ****
  configure:1443: checking for mv
  configure:1479: checking for tar
  configure:1517: checking for cc option to accept ANSI C
! configure:1570: cc  -c   conftest.c 1>&5
  "configure", line 1567: warning: statement not reached
  configure:1596: checking for function prototypes
  configure:1757: checking for Cygwin environment
! configure:1773: cc -c   conftest.c 1>&5
  "configure", line 1769: undefined symbol: __CYGWIN32__
  "configure", line 1770: warning: statement not reached
  cc: acomp failed for conftest.c
--- 24,34 ----
  configure:1443: checking for mv
  configure:1479: checking for tar
  configure:1517: checking for cc option to accept ANSI C
! configure:1570: cc  -c -g  conftest.c 1>&5
  "configure", line 1567: warning: statement not reached
  configure:1596: checking for function prototypes
  configure:1757: checking for Cygwin environment
! configure:1773: cc -c -g  conftest.c 1>&5
  "configure", line 1769: undefined symbol: __CYGWIN32__
  "configure", line 1770: warning: statement not reached
  cc: acomp failed for conftest.c
***************
*** 44,50 ****
  return __CYGWIN__;
  ; return 0; }
  configure:1790: checking for mingw32 environment
! configure:1802: cc -c   conftest.c 1>&5
  "configure", line 1798: undefined symbol: __MINGW32__
  "configure", line 1799: warning: statement not reached
  cc: acomp failed for conftest.c
--- 44,50 ----
  return __CYGWIN__;
  ; return 0; }
  configure:1790: checking for mingw32 environment
! configure:1802: cc -c -g  conftest.c 1>&5
  "configure", line 1798: undefined symbol: __MINGW32__
  "configure", line 1799: warning: statement not reached
  cc: acomp failed for conftest.c
***************
*** 63,75 ****
  configure:2052: checking whether ln -s works
  configure:2073: checking how to recognise dependant libraries
  configure:2246: checking for object suffix
! configure:2252: cc -c   conftest.c 1>&5
  configure:2272: checking for executable suffix
! configure:2282: cc -o conftest    conftest.c  1>&5
  configure:2313: checking command to parse /usr/ccs/bin/nm -p output
! configure:2389: cc -c   conftest.c 1>&5
  configure:2392: /usr/ccs/bin/nm -p conftest.o | sed -n -e 's/^.*[ ]\([BDT][BDT]*\)[ ][ 
]*\(\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p' > conftest.nm
! configure:2443: cc -o conftest    conftest.c conftstm.o 1>&5
  configure:2489: checking for dlfcn.h
  configure:2499: cc -E  conftest.c >/dev/null 2>conftest.out
  configure:2667: checking for ranlib
--- 63,75 ----
  configure:2052: checking whether ln -s works
  configure:2073: checking how to recognise dependant libraries
  configure:2246: checking for object suffix
! configure:2252: cc -c -g  conftest.c 1>&5
  configure:2272: checking for executable suffix
! configure:2282: cc -o conftest -g   conftest.c  1>&5
  configure:2313: checking command to parse /usr/ccs/bin/nm -p output
! configure:2389: cc -c -g  conftest.c 1>&5
  configure:2392: /usr/ccs/bin/nm -p conftest.o | sed -n -e 's/^.*[ ]\([BDT][BDT]*\)[ ][ 
]*\(\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p' > conftest.nm
! configure:2443: cc -o conftest -g   conftest.c conftstm.o 1>&5
  configure:2489: checking for dlfcn.h
  configure:2499: cc -E  conftest.c >/dev/null 2>conftest.out
  configure:2667: checking for ranlib
***************
*** 77,89 ****
  configure:2970: checking for objdir
  configure:2997: checking for cc option to produce PIC
  configure:3149: checking if cc PIC flag -KPIC works
! configure:3163: cc -c  -KPIC -DPIC  conftest.c 1>&5
  configure:3215: checking if cc static flag -Bstatic works
! configure:3230: cc -o conftest    -Bstatic conftest.c  1>&5
  configure:3257: checking if cc supports -c -o file.o
! configure:3276: cc -c  -o out/conftest2.o  conftest.c 1>&5
  configure:3305: checking if cc supports -c -o file.lo
! configure:3321: cc -c  -c -o conftest.lo  conftest.c 1>&5
  cc: illegal suffix of output filename
  configure: failed program was:
  #line 3314 "configure"
--- 77,89 ----
  configure:2970: checking for objdir
  configure:2997: checking for cc option to produce PIC
  configure:3149: checking if cc PIC flag -KPIC works
! configure:3163: cc -c -g -KPIC -DPIC  conftest.c 1>&5
  configure:3215: checking if cc static flag -Bstatic works
! configure:3230: cc -o conftest -g   -Bstatic conftest.c  1>&5
  configure:3257: checking if cc supports -c -o file.o
! configure:3276: cc -c -g -o out/conftest2.o  conftest.c 1>&5
  configure:3305: checking if cc supports -c -o file.lo
! configure:3321: cc -c -g -c -o conftest.lo  conftest.c 1>&5
  cc: illegal suffix of output filename
  configure: failed program was:
  #line 3314 "configure"
***************
*** 101,111 ****
  configure:5589: checking for zlib.h
  configure:5599: cc -E  conftest.c >/dev/null 2>conftest.out
  configure:5620: checking for gzread in -lz
! configure:5639: cc -o conftest    conftest.c -lz   1>&5
  configure:5690: checking for dirent.h that defines DIR
! configure:5703: cc -c   conftest.c 1>&5
  configure:5728: checking for opendir in -ldir
! configure:5747: cc -o conftest    conftest.c -ldir   1>&5
  ld: fatal: library -ldir: not found
  ld: fatal: File processing errors. No output written to conftest
  configure: failed program was:
--- 101,111 ----
  configure:5589: checking for zlib.h
  configure:5599: cc -E  conftest.c >/dev/null 2>conftest.out
  configure:5620: checking for gzread in -lz
! configure:5639: cc -o conftest -g   conftest.c -lz   1>&5
  configure:5690: checking for dirent.h that defines DIR
! configure:5703: cc -c -g  conftest.c 1>&5
  configure:5728: checking for opendir in -ldir
! configure:5747: cc -o conftest -g   conftest.c -ldir   1>&5
  ld: fatal: library -ldir: not found
  ld: fatal: File processing errors. No output written to conftest
  configure: failed program was:
***************
*** 121,127 ****
  ; return 0; }
  configure:5811: checking for ANSI C header files
  configure:5824: cc -E  conftest.c >/dev/null 2>conftest.out
! configure:5891: cc -o conftest    conftest.c  1>&5
  configure:5918: checking for fcntl.h
  configure:5928: cc -E  conftest.c >/dev/null 2>conftest.out
  configure:5918: checking for unistd.h
--- 121,127 ----
  ; return 0; }
  configure:5811: checking for ANSI C header files
  configure:5824: cc -E  conftest.c >/dev/null 2>conftest.out
! configure:5891: cc -o conftest -g   conftest.c  1>&5
  configure:5918: checking for fcntl.h
  configure:5928: cc -E  conftest.c >/dev/null 2>conftest.out
  configure:5918: checking for unistd.h
***************
*** 185,195 ****
  configure:6118: checking for signal.h
  configure:6128: cc -E  conftest.c >/dev/null 2>conftest.out
  configure:6164: checking for strftime
! configure:6192: cc -o conftest    conftest.c  1>&5
  configure:6262: checking for strdup
! configure:6290: cc -o conftest    conftest.c  1>&5
  configure:6262: checking for strndup
! configure:6290: cc -o conftest    conftest.c  1>&5
  Undefined                     first referenced
   symbol                           in file
  strndup                             conftest.o
--- 185,195 ----
  configure:6118: checking for signal.h
  configure:6128: cc -E  conftest.c >/dev/null 2>conftest.out
  configure:6164: checking for strftime
! configure:6192: cc -o conftest -g   conftest.c  1>&5
  configure:6262: checking for strdup
! configure:6290: cc -o conftest -g   conftest.c  1>&5
  configure:6262: checking for strndup
! configure:6290: cc -o conftest -g   conftest.c  1>&5
  Undefined                     first referenced
   symbol                           in file
  strndup                             conftest.o
***************
*** 218,230 ****
  
  ; return 0; }
  configure:6262: checking for strerror
! configure:6290: cc -o conftest    conftest.c  1>&5
  configure:6317: checking for finite
! configure:6345: cc -o conftest    conftest.c  1>&5
  configure:6317: checking for isnand
! configure:6345: cc -o conftest    conftest.c  1>&5
  configure:6317: checking for fp_class
! configure:6345: cc -o conftest    conftest.c  1>&5
  Undefined                     first referenced
   symbol                           in file
  fp_class                            conftest.o
--- 218,230 ----
  
  ; return 0; }
  configure:6262: checking for strerror
! configure:6290: cc -o conftest -g   conftest.c  1>&5
  configure:6317: checking for finite
! configure:6345: cc -o conftest -g   conftest.c  1>&5
  configure:6317: checking for isnand
! configure:6345: cc -o conftest -g   conftest.c  1>&5
  configure:6317: checking for fp_class
! configure:6345: cc -o conftest -g   conftest.c  1>&5
  Undefined                     first referenced
   symbol                           in file
  fp_class                            conftest.o
***************
*** 253,259 ****
  
  ; return 0; }
  configure:6317: checking for class
! configure:6345: cc -o conftest    conftest.c  1>&5
  Undefined                     first referenced
   symbol                           in file
  class                               conftest.o
--- 253,259 ----
  
  ; return 0; }
  configure:6317: checking for class
! configure:6345: cc -o conftest -g   conftest.c  1>&5
  Undefined                     first referenced
   symbol                           in file
  class                               conftest.o
***************
*** 282,315 ****
  
  ; return 0; }
  configure:6317: checking for fpclass
! configure:6345: cc -o conftest    conftest.c  1>&5
  configure:6372: checking for strftime
  configure:6372: checking for localtime
! configure:6400: cc -o conftest    conftest.c  1>&5
  configure:6427: checking for stat
! configure:6455: cc -o conftest    conftest.c  1>&5
  configure:6427: checking for _stat
! configure:6455: cc -o conftest    conftest.c  1>&5
  configure:6427: checking for signal
! configure:6455: cc -o conftest    conftest.c  1>&5
  configure:6483: checking for printf
! configure:6511: cc -o conftest    conftest.c  1>&5
  configure:6483: checking for sprintf
! configure:6511: cc -o conftest    conftest.c  1>&5
  configure:6483: checking for fprintf
! configure:6511: cc -o conftest    conftest.c  1>&5
  configure:6483: checking for snprintf
! configure:6511: cc -o conftest    conftest.c  1>&5
  configure:6483: checking for vfprintf
! configure:6511: cc -o conftest    conftest.c  1>&5
  configure:6483: checking for vsprintf
! configure:6511: cc -o conftest    conftest.c  1>&5
  configure:6483: checking for vsnprintf
! configure:6511: cc -o conftest    conftest.c  1>&5
  configure:6483: checking for sscanf
! configure:6511: cc -o conftest    conftest.c  1>&5
  configure:6538: checking for gethostent
! configure:6566: cc -o conftest    conftest.c  1>&5
  Undefined                     first referenced
   symbol                           in file
  gethostent                          conftest.o
--- 282,315 ----
  
  ; return 0; }
  configure:6317: checking for fpclass
! configure:6345: cc -o conftest -g   conftest.c  1>&5
  configure:6372: checking for strftime
  configure:6372: checking for localtime
! configure:6400: cc -o conftest -g   conftest.c  1>&5
  configure:6427: checking for stat
! configure:6455: cc -o conftest -g   conftest.c  1>&5
  configure:6427: checking for _stat
! configure:6455: cc -o conftest -g   conftest.c  1>&5
  configure:6427: checking for signal
! configure:6455: cc -o conftest -g   conftest.c  1>&5
  configure:6483: checking for printf
! configure:6511: cc -o conftest -g   conftest.c  1>&5
  configure:6483: checking for sprintf
! configure:6511: cc -o conftest -g   conftest.c  1>&5
  configure:6483: checking for fprintf
! configure:6511: cc -o conftest -g   conftest.c  1>&5
  configure:6483: checking for snprintf
! configure:6511: cc -o conftest -g   conftest.c  1>&5
  configure:6483: checking for vfprintf
! configure:6511: cc -o conftest -g   conftest.c  1>&5
  configure:6483: checking for vsprintf
! configure:6511: cc -o conftest -g   conftest.c  1>&5
  configure:6483: checking for vsnprintf
! configure:6511: cc -o conftest -g   conftest.c  1>&5
  configure:6483: checking for sscanf
! configure:6511: cc -o conftest -g   conftest.c  1>&5
  configure:6538: checking for gethostent
! configure:6566: cc -o conftest -g   conftest.c  1>&5
  Undefined                     first referenced
   symbol                           in file
  gethostent                          conftest.o
***************
*** 338,346 ****
  
  ; return 0; }
  configure:6584: checking for gethostent in -lnsl
! configure:6603: cc -o conftest    conftest.c -lnsl   1>&5
  configure:6633: checking for setsockopt
! configure:6661: cc -o conftest    conftest.c -lnsl  1>&5
  Undefined                     first referenced
   symbol                           in file
  setsockopt                          conftest.o
--- 338,346 ----
  
  ; return 0; }
  configure:6584: checking for gethostent in -lnsl
! configure:6603: cc -o conftest -g   conftest.c -lnsl   1>&5
  configure:6633: checking for setsockopt
! configure:6661: cc -o conftest -g   conftest.c -lnsl  1>&5
  Undefined                     first referenced
   symbol                           in file
  setsockopt                          conftest.o
***************
*** 369,383 ****
  
  ; return 0; }
  configure:6679: checking for setsockopt in -lsocket
! configure:6698: cc -o conftest    conftest.c -lsocket  -lnsl  1>&5
  configure:6728: checking for connect
! configure:6756: cc -o conftest    conftest.c -lsocket -lnsl  1>&5
  configure:6824: checking for type of socket length (socklen_t)
! configure:6837: cc -c   conftest.c 1>&5
  configure:6904: checking for isnan
! configure:6932: cc -o conftest    conftest.c -lsocket -lnsl  1>&5
  configure:6996: checking for isinf
! configure:7024: cc -o conftest    conftest.c -lsocket -lnsl  1>&5
  Undefined                     first referenced
   symbol                           in file
  isinf                               conftest.o
--- 369,383 ----
  
  ; return 0; }
  configure:6679: checking for setsockopt in -lsocket
! configure:6698: cc -o conftest -g   conftest.c -lsocket  -lnsl  1>&5
  configure:6728: checking for connect
! configure:6756: cc -o conftest -g   conftest.c -lsocket -lnsl  1>&5
  configure:6824: checking for type of socket length (socklen_t)
! configure:6837: cc -c -g  conftest.c 1>&5
  configure:6904: checking for isnan
! configure:6932: cc -o conftest -g   conftest.c -lsocket -lnsl  1>&5
  configure:6996: checking for isinf
! configure:7024: cc -o conftest -g   conftest.c -lsocket -lnsl  1>&5
  Undefined                     first referenced
   symbol                           in file
  isinf                               conftest.o
***************
*** 406,412 ****
  
  ; return 0; }
  configure:7045: checking for isinf in -lm
! configure:7064: cc -o conftest    conftest.c -lm  -lsocket -lnsl  1>&5
  Undefined                     first referenced
   symbol                           in file
  isinf                               conftest.o
--- 406,412 ----
  
  ; return 0; }
  configure:7045: checking for isinf in -lm
! configure:7064: cc -o conftest -g   conftest.c -lm  -lsocket -lnsl  1>&5
  Undefined                     first referenced
   symbol                           in file
  isinf                               conftest.o
***************
*** 425,428 ****
  configure:7555: checking for iconv.h
  configure:7565: cc -E  -I/include conftest.c >/dev/null 2>conftest.out
  configure:7582: checking for iconv
! configure:7594: cc -o conftest   -I/include  conftest.c -lsocket -lnsl  1>&5
--- 425,428 ----
  configure:7555: checking for iconv.h
  configure:7565: cc -E  -I/include conftest.c >/dev/null 2>conftest.out
  configure:7582: checking for iconv
! configure:7594: cc -o conftest -g  -I/include  conftest.c -lsocket -lnsl  1>&5
diff -c libxml2-2.4.5/config.status ../libxml2-2.4.5/config.status
*** libxml2-2.4.5/config.status Thu Oct 11 10:55:56 2001
--- ../libxml2-2.4.5/config.status      Wed Sep 19 16:47:34 2001
***************
*** 36,42 ****
  /^[   ]*VPATH[        ]*=[^:]*$/d
  
  s% SHELL@%/bin/sh%g
! s% CFLAGS@%%g
  s% CPPFLAGS@% -I/include%g
  s% CXXFLAGS@%%g
  s% FFLAGS@%%g
--- 36,42 ----
  /^[   ]*VPATH[        ]*=[^:]*$/d
  
  s% SHELL@%/bin/sh%g
! s% CFLAGS@%-g%g
  s% CPPFLAGS@% -I/include%g
  s% CXXFLAGS@%%g
  s% FFLAGS@%%g
***************
*** 78,84 ****
  s% AUTOCONF@%autoconf%g
  s% AUTOMAKE@%automake%g
  s% AUTOHEADER@%autoheader%g
! s% MAKEINFO@%/home/garyp/LIB_XML_BUILD/TEMP/libxml2-2.4.5/missing makeinfo%g
  s% SET_MAKE@%%g
  s% CC@%cc%g
  s% CPP@%cc -E%g
--- 78,84 ----
  s% AUTOCONF@%autoconf%g
  s% AUTOMAKE@%automake%g
  s% AUTOHEADER@%autoheader%g
! s% MAKEINFO@%/home/garyp/LIB_XML_BUILD/libxml2-2.4.5/missing makeinfo%g
  s% SET_MAKE@%%g
  s% CC@%cc%g
  s% CPP@%cc -E%g
Only in ../libxml2-2.4.5: cscope.out
diff -c libxml2-2.4.5/debugXML.c ../libxml2-2.4.5/debugXML.c
*** libxml2-2.4.5/debugXML.c    Wed Aug 15 13:23:11 2001
--- ../libxml2-2.4.5/debugXML.c Fri Oct  5 15:30:20 2001
***************
*** 567,573 ****
              break;
          case XML_TEXT_NODE:
              fprintf(output, shift);
!           if (node->name == xmlStringTextNoenc)
                fprintf(output, "TEXT no enc\n");
            else
                fprintf(output, "TEXT\n");
--- 567,573 ----
              break;
          case XML_TEXT_NODE:
              fprintf(output, shift);
!           if (node->name == (const xmlChar *)xmlStringTextNoenc)
                fprintf(output, "TEXT no enc\n");
            else
                fprintf(output, "TEXT\n");
Common subdirectories: libxml2-2.4.5/doc and ../libxml2-2.4.5/doc
diff -c libxml2-2.4.5/encoding.c ../libxml2-2.4.5/encoding.c
*** libxml2-2.4.5/encoding.c    Fri Sep 14 18:34:21 2001
--- ../libxml2-2.4.5/encoding.c Fri Oct  5 15:15:10 2001
***************
*** 1899,1905 ****
      char *icv_out = (char *) out;
      int ret;
  
!     ret = iconv(cd, (char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
      if (in != NULL) {
          *inlen -= icv_inlen;
          *outlen -= icv_outlen;
--- 1899,1905 ----
      char *icv_out = (char *) out;
      int ret;
  
!     ret = iconv(cd, (const char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
      if (in != NULL) {
          *inlen -= icv_inlen;
          *outlen -= icv_outlen;
diff -c libxml2-2.4.5/entities.c ../libxml2-2.4.5/entities.c
*** libxml2-2.4.5/entities.c    Fri Sep 14 18:34:21 2001
--- ../libxml2-2.4.5/entities.c Wed Oct  3 10:11:08 2001
***************
*** 38,44 ****
   * TODO: This is GROSS, allocation of a 256 entry hash for
   *       a fixed number of 4 elements !
   */
! xmlHashTablePtr xmlPredefinedEntities = NULL;
  
  /*
   * xmlFreeEntity : clean-up an entity record.
--- 38,44 ----
   * TODO: This is GROSS, allocation of a 256 entry hash for
   *       a fixed number of 4 elements !
   */
! static xmlHashTablePtr xmlPredefinedEntities = NULL;
  
  /*
   * xmlFreeEntity : clean-up an entity record.
diff -c libxml2-2.4.5/error.c ../libxml2-2.4.5/error.c
*** libxml2-2.4.5/error.c       Sun Jun 24 13:13:57 2001
--- ../libxml2-2.4.5/error.c    Thu Oct 11 17:15:29 2001
***************
*** 57,63 ****
   * 
   * Default handler for out of context error messages.
   */
! static void
  xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
      va_list args;
  
--- 57,63 ----
   * 
   * Default handler for out of context error messages.
   */
! void
  xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
      va_list args;
  
***************
*** 69,78 ****
      va_end(args);
  }
  
! xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
! void *xmlGenericErrorContext = NULL;
  
- 
  /**
   * xmlSetGenericErrorFunc:
   * @ctx:  the new error handling context
--- 69,83 ----
      va_end(args);
  }
  
! void
! initGenericErrorDefaultFunc(xmlGenericErrorFunc *handler)
! {
!       if (handler == NULL)
!               xmlGenericError = xmlGenericErrorDefaultFunc;
!       else
!               (*handler) = xmlGenericErrorDefaultFunc;
! }
  
  /**
   * xmlSetGenericErrorFunc:
   * @ctx:  the new error handling context
Common subdirectories: libxml2-2.4.5/example and ../libxml2-2.4.5/example
Only in ../libxml2-2.4.5: global.data
Only in ../libxml2-2.4.5: global_functions.c
Only in ../libxml2-2.4.5: global_utils.c
Common subdirectories: libxml2-2.4.5/include and ../libxml2-2.4.5/include
Only in ../libxml2-2.4.5: local.data
diff -c libxml2-2.4.5/nanoftp.c ../libxml2-2.4.5/nanoftp.c
*** libxml2-2.4.5/nanoftp.c     Fri Aug 24 00:21:29 2001
--- ../libxml2-2.4.5/nanoftp.c  Mon Oct  8 15:01:51 2001
***************
*** 57,62 ****
--- 57,63 ----
  
  #include <libxml/xmlmemory.h>
  #include <libxml/nanoftp.h>
+ #include <libxml/global_functions.h>
  #include <libxml/xmlerror.h>
  
  /* #define DEBUG_FTP 1  */
***************
*** 74,80 ****
  #define SOCKET int
  #endif
  
! static char hostname[100];
  
  #define FTP_COMMAND_OK                200
  #define FTP_SYNTAX_ERROR      500
--- 75,81 ----
  #define SOCKET int
  #endif
  
! /* static char hostname[100]; */
  
  #define FTP_COMMAND_OK                200
  #define FTP_SYNTAX_ERROR      500
***************
*** 131,137 ****
        return;
  #endif
  
!     gethostname(hostname, sizeof(hostname));
  
      proxyPort = 21;
      env = getenv("no_proxy");
--- 132,138 ----
        return;
  #endif
  
!     /* gethostname(hostname, sizeof(hostname)); */
  
      proxyPort = 21;
      env = getenv("no_proxy");
***************
*** 177,183 ****
        xmlFree(proxyPasswd);
        proxyPasswd = NULL;
      }
!     hostname[0] = 0;
  #ifdef _WINSOCKAPI_
      if (initialized)
        WSACleanup();
--- 178,184 ----
        xmlFree(proxyPasswd);
        proxyPasswd = NULL;
      }
!     /* hostname[0] = 0; */
  #ifdef _WINSOCKAPI_
      if (initialized)
        WSACleanup();
***************
*** 777,784 ****
      int len;
      int res;
  
!     if (ctxt->passwd == NULL)
        snprintf(buf, sizeof(buf), "PASS libxml %s\r\n", hostname);
      else
        snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
      buf[sizeof(buf) - 1] = 0;
--- 778,788 ----
      int len;
      int res;
  
!     if (ctxt->passwd == NULL) {
!               char hostname[100];
!               gethostname(hostname, sizeof (hostname));
        snprintf(buf, sizeof(buf), "PASS libxml %s\r\n", hostname);
+       }
      else
        snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
      buf[sizeof(buf) - 1] = 0;
***************
*** 949,957 ****
                case 3:
                    if (proxyPasswd != NULL)
                        snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
!                   else
                        snprintf(buf, sizeof(buf), "PASS libxml %s\r\n",
                                       hostname);
                      buf[sizeof(buf) - 1] = 0;
                      len = strlen(buf);
  #ifdef DEBUG_FTP
--- 953,964 ----
                case 3:
                    if (proxyPasswd != NULL)
                        snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
!                   else {
!               char hostname[100];
!               gethostname(hostname, sizeof (hostname));
                        snprintf(buf, sizeof(buf), "PASS libxml %s\r\n",
                                       hostname);
+               }
                      buf[sizeof(buf) - 1] = 0;
                      len = strlen(buf);
  #ifdef DEBUG_FTP
***************
*** 1039,1046 ****
                    proxyType = 2;
                    return(0);
                }    
!               if (ctxt->passwd == NULL)
                    snprintf(buf, sizeof(buf), "PASS libxml %s\r\n", hostname);
                else
                    snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
                  buf[sizeof(buf) - 1] = 0;
--- 1046,1056 ----
                    proxyType = 2;
                    return(0);
                }    
!               if (ctxt->passwd == NULL) {
!                       char hostname[100];
!                       gethostname(hostname, sizeof (hostname));
                    snprintf(buf, sizeof(buf), "PASS libxml %s\r\n", hostname);
+               }
                else
                    snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
                  buf[sizeof(buf) - 1] = 0;
diff -c libxml2-2.4.5/nanohttp.c ../libxml2-2.4.5/nanohttp.c
*** libxml2-2.4.5/nanohttp.c    Sat Aug  4 03:35:06 2001
--- ../libxml2-2.4.5/nanohttp.c Fri Oct  5 16:47:58 2001
***************
*** 63,68 ****
--- 63,69 ----
  #define SOCKET int
  #endif
  
+ #include <libxml/global_functions.h>
  #include <libxml/xmlerror.h>
  #include <libxml/xmlmemory.h>
  #include <libxml/parser.h> /* for xmlStr(n)casecmp() */
diff -c libxml2-2.4.5/parser.c ../libxml2-2.4.5/parser.c
*** libxml2-2.4.5/parser.c      Wed Sep 12 03:35:06 2001
--- ../libxml2-2.4.5/parser.c   Thu Oct 11 17:11:36 2001
***************
*** 78,92 ****
  #define XML_PARSER_BUFFER_SIZE 100
  
  /*
-  * Various global defaults for parsing
-  */
- int xmlParserDebugEntities = 0;
- 
- /*
   * List of XML prefixed PI allowed by W3C specs
   */
  
! const char *xmlW3CPIs[] = {
      "xml-stylesheet",
      NULL
  };
--- 78,87 ----
  #define XML_PARSER_BUFFER_SIZE 100
  
  /*
   * List of XML prefixed PI allowed by W3C specs
   */
  
! static const char *xmlW3CPIs[] = {
      "xml-stylesheet",
      NULL
  };
***************
*** 1187,1193 ****
      return 0;
  }
  
! static 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,
--- 1182,1188 ----
      return 0;
  }
  
! 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,
***************
*** 10163,10168 ****
--- 10158,10165 ----
  xmlInitParser(void) {
      if (xmlParserInitialized) return;
  
+       lib_lock_alloc();
+       initGenericErrorDefaultFunc(NULL);
      xmlInitCharEncodingHandlers();
      xmlInitializePredefinedEntities();
      xmlDefaultSAXHandlerInit();
***************
*** 10189,10199 ****
  
  void
  xmlCleanupParser(void) {
!     xmlParserInitialized = 0;
      xmlCleanupCharEncodingHandlers();
      xmlCleanupPredefinedEntities();
  #ifdef LIBXML_CATALOG_ENABLED
      xmlCatalogCleanup();
  #endif
  }
- 
--- 10186,10196 ----
  
  void
  xmlCleanupParser(void) {
!       lib_lock_free();
      xmlCleanupCharEncodingHandlers();
      xmlCleanupPredefinedEntities();
  #ifdef LIBXML_CATALOG_ENABLED
      xmlCatalogCleanup();
  #endif
+     xmlParserInitialized = 0;
  }
diff -c libxml2-2.4.5/parserInternals.c ../libxml2-2.4.5/parserInternals.c
*** libxml2-2.4.5/parserInternals.c     Fri Sep 14 18:34:21 2001
--- ../libxml2-2.4.5/parserInternals.c  Thu Oct 11 16:58:25 2001
***************
*** 56,83 ****
  /*
   * Various global defaults for parsing
   */
- int xmlGetWarningsDefaultValue = 1;
  #ifdef VMS
  int xmlSubstituteEntitiesDefaultVal = 0;
  #define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal 
  int xmlDoValidityCheckingDefaultVal = 0;
  #define xmlDoValidityCheckingDefaultValue xmlDoValidityCheckingDefaultVal
- #else
- int xmlSubstituteEntitiesDefaultValue = 0;
- int xmlDoValidityCheckingDefaultValue = 0;
  #endif
- int xmlLoadExtDtdDefaultValue = 0;
- int xmlPedanticParserDefaultValue = 0;
- int xmlLineNumbersDefaultValue = 0;
- int xmlKeepBlanksDefaultValue = 1;
  
- /************************************************************************
-  *                                                                    *
-  *            Version and Features handling                           *
-  *                                                                    *
-  ************************************************************************/
- const char *xmlParserVersion = LIBXML_VERSION_STRING;
- 
  /**
   * xmlCheckVersion:
   * @version: the include version number
--- 56,68 ----
***************
*** 2150,2155 ****
--- 2135,2143 ----
                "xmlInitParserCtxt: NULL context given\n");
          return;
      }
+ #if defined(_REENTRANT) || (POSIX_C_SOURCE - 0 >= 199506L)
+     pthread_mutex_init(&ctxt->lock, NULL);
+ #endif
  
      xmlDefaultSAXHandlerInit();
  
***************
*** 2256,2261 ****
--- 2244,2250 ----
      ctxt->wellFormed = 1;
      ctxt->valid = 1;
      ctxt->loadsubset = xmlLoadExtDtdDefaultValue;
+       printf("xmlDoValidityCheckingDefaultValue = %d\n", xmlDoValidityCheckingDefaultValue);
      ctxt->validate = xmlDoValidityCheckingDefaultValue;
      ctxt->pedantic = xmlPedanticParserDefaultValue;
      ctxt->linenumbers = xmlLineNumbersDefaultValue;
***************
*** 2326,2331 ****
--- 2315,2323 ----
      if (ctxt->catalogs != NULL)
        xmlCatalogFreeLocal(ctxt->catalogs);
  #endif
+ #if defined(_REENTRANT) || (POSIX_C_SOURCE - 0 >= 199506L)
+     pthread_mutex_destroy(&ctxt->lock);
+ #endif
      xmlFree(ctxt);
  }
  
Common subdirectories: libxml2-2.4.5/result and ../libxml2-2.4.5/result
Common subdirectories: libxml2-2.4.5/test and ../libxml2-2.4.5/test
diff -c libxml2-2.4.5/testSAX.c ../libxml2-2.4.5/testSAX.c
*** libxml2-2.4.5/testSAX.c     Sat Aug  4 03:35:06 2001
--- ../libxml2-2.4.5/testSAX.c  Fri Oct  5 16:48:43 2001
***************
*** 31,36 ****
--- 31,37 ----
  #endif
  
  
+ #include <libxml/global_functions.h>
  #include <libxml/xmlerror.h>
  #include <libxml/parser.h>
  #include <libxml/parserInternals.h> /* only for xmlNewInputFromFile() */
diff -c libxml2-2.4.5/tree.c ../libxml2-2.4.5/tree.c
*** libxml2-2.4.5/tree.c        Sat Sep  1 03:35:09 2001
--- ../libxml2-2.4.5/tree.c     Thu Oct 11 16:57:51 2001
***************
*** 38,65 ****
  
  /************************************************************************
   *                                                                    *
-  *                    Deprecated                                      *
-  *                                                                    *
-  ************************************************************************/
- int oldXMLWDcompatibility = 0;
-  
- /************************************************************************
-  *                                                                    *
   *            A few static variables and macros                       *
   *                                                                    *
   ************************************************************************/
! 
  const xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
  const xmlChar xmlStringTextNoenc[] =
                { 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 };
  const xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
  
- int xmlIndentTreeOutput = 0;
- xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
- 
  static int xmlCompressMode = 0;
  static int xmlCheckDTD = 1;
- int xmlSaveNoEmptyTags = 0;
  
  #define UPDATE_LAST_CHILD_AND_PARENT(n) if ((n) != NULL) {            \
      xmlNodePtr ulccur = (n)->children;                                        \
--- 38,56 ----
  
  /************************************************************************
   *                                                                    *
   *            A few static variables and macros                       *
   *                                                                    *
   ************************************************************************/
! /* #undef xmlStringText */
  const xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
+ /* #undef xmlStringTextNoenc */
  const xmlChar xmlStringTextNoenc[] =
                { 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 };
+ /* #undef xmlStringComment */
  const xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
  
  static int xmlCompressMode = 0;
  static int xmlCheckDTD = 1;
  
  #define UPDATE_LAST_CHILD_AND_PARENT(n) if ((n) != NULL) {            \
      xmlNodePtr ulccur = (n)->children;                                        \
***************
*** 4741,4750 ****
   *                                                                    *
   ************************************************************************/
  
- #define BASE_BUFFER_SIZE 4000
- 
- int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
- 
  /**
   * xmlBufferCreate:
   *
--- 4732,4737 ----
diff -c libxml2-2.4.5/uri.c ../libxml2-2.4.5/uri.c
*** libxml2-2.4.5/uri.c Tue Jun 26 17:09:18 2001
--- ../libxml2-2.4.5/uri.c      Fri Oct  5 16:46:57 2001
***************
*** 14,19 ****
--- 14,20 ----
  
  #include <libxml/xmlmemory.h>
  #include <libxml/uri.h>
+ #include <libxml/global_functions.h>
  #include <libxml/xmlerror.h>
  
  /************************************************************************
diff -c libxml2-2.4.5/valid.c ../libxml2-2.4.5/valid.c
*** libxml2-2.4.5/valid.c       Mon Aug 27 03:35:05 2001
--- ../libxml2-2.4.5/valid.c    Mon Oct  8 13:01:57 2001
***************
*** 81,95 ****
  #define ROLLBACK_OR   0
  #define ROLLBACK_PARENT       1
  
! 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 */
      unsigned char        depth; /* current depth in the overall tree */
      unsigned char        state; /* ROLLBACK_XXX */
! } _xmlValidState;
  
! #define MAX_DEPTH ((sizeof(_xmlValidState.occurs)) * 8)
  #define CONT ctxt->vstate->cont
  #define NODE ctxt->vstate->node
  #define DEPTH ctxt->vstate->depth
--- 81,95 ----
  #define ROLLBACK_OR   0
  #define ROLLBACK_PARENT       1
  
! static 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 */
      unsigned char        depth; /* current depth in the overall tree */
      unsigned char        state; /* ROLLBACK_XXX */
! };
  
! #define MAX_DEPTH ((sizeof(xmlValidState.occurs)) * 8)
  #define CONT ctxt->vstate->cont
  #define NODE ctxt->vstate->node
  #define DEPTH ctxt->vstate->depth
Common subdirectories: libxml2-2.4.5/vms and ../libxml2-2.4.5/vms
Common subdirectories: libxml2-2.4.5/win32 and ../libxml2-2.4.5/win32
diff -c libxml2-2.4.5/xlink.c ../libxml2-2.4.5/xlink.c
*** libxml2-2.4.5/xlink.c       Sun Jun 24 13:13:58 2001
--- ../libxml2-2.4.5/xlink.c    Wed Oct  3 10:08:49 2001
***************
*** 45,52 ****
   *                                                            *
   ****************************************************************/
   
! xlinkHandlerPtr xlinkDefaultHandler = NULL;
! xlinkNodeDetectFunc   xlinkDefaultDetect = NULL;
  
  /**
   * xlinkGetDefaultHandler:
--- 45,52 ----
   *                                                            *
   ****************************************************************/
   
! static xlinkHandlerPtr xlinkDefaultHandler = NULL;
! static xlinkNodeDetectFunc    xlinkDefaultDetect = NULL;
  
  /**
   * xlinkGetDefaultHandler:
diff -c libxml2-2.4.5/xmlmemory.c ../libxml2-2.4.5/xmlmemory.c
*** libxml2-2.4.5/xmlmemory.c   Tue Jul 31 03:35:05 2001
--- ../libxml2-2.4.5/xmlmemory.c        Thu Oct 11 16:54:18 2001
***************
*** 26,31 ****
--- 26,32 ----
  
  
  #include <libxml/xmlmemory.h>
+ #include <libxml/global_functions.h>
  #include <libxml/xmlerror.h>
  
  void xmlMallocBreakpoint(void);
***************
*** 94,102 ****
  static unsigned long  debugMemSize = 0;
  static unsigned long  debugMaxMemSize = 0;
  static int block=0;
! int xmlMemStopAtBlock = 0;
! void *xmlMemTraceBlockAt = NULL;
! int xmlMemInitialized = 0;
  #ifdef MEM_LIST
  static MEMHDR *memlist = NULL;
  #endif
--- 95,103 ----
  static unsigned long  debugMemSize = 0;
  static unsigned long  debugMaxMemSize = 0;
  static int block=0;
! static int xmlMemStopAtBlock = 0;
! static void *xmlMemTraceBlockAt = NULL;
! static int xmlMemInitialized = 0;
  #ifdef MEM_LIST
  static MEMHDR *memlist = NULL;
  #endif
***************
*** 625,631 ****
  #endif
  }
  
! FILE *xmlMemoryDumpFile = NULL;
  
  
  /**
--- 626,632 ----
  #endif
  }
  
! static FILE *xmlMemoryDumpFile = NULL;
  
  
  /**
***************
*** 657,674 ****
   *                                                            *
   ****************************************************************/
  
- #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
- xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
- xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
- xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
- xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
- #else
- xmlFreeFunc xmlFree = (xmlFreeFunc) free;
- xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
- xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
- xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) strdup;
- #endif
- 
  /**
   * xmlInitMemory:
   *
--- 658,663 ----
diff -c libxml2-2.4.5/xpath.c ../libxml2-2.4.5/xpath.c
*** libxml2-2.4.5/xpath.c       Tue Aug 28 03:35:07 2001
--- ../libxml2-2.4.5/xpath.c    Fri Oct  5 15:25:12 2001
***************
*** 74,82 ****
  /*
   * The lack of portability of this section of the libc is annoying !
   */
! double xmlXPathNAN = 0;
! double xmlXPathPINF = 1;
! double xmlXPathNINF = -1;
  
  /**
   * xmlXPathInit:
--- 74,82 ----
  /*
   * The lack of portability of this section of the libc is annoying !
   */
! static double xmlXPathNAN = 0;
! static double xmlXPathPINF = 1;
! static double xmlXPathNINF = -1;
  
  /**
   * xmlXPathInit:
***************
*** 1167,1173 ****
   ************************************************************************/
  
  
! const char *xmlXPathErrorMessages[] = {
      "Ok",
      "Number encoding",
      "Unfinished litteral",
--- 1167,1173 ----
   ************************************************************************/
  
  
! static const char *xmlXPathErrorMessages[] = {
      "Ok",
      "Number encoding",
      "Unfinished litteral",
***************
*** 3820,3826 ****
            TODO
            return(0);
      }
!     return(0);
  }
  
  /**
--- 3820,3826 ----
            TODO
            return(0);
      }
! /*     return(0); */
  }
  
  /**
***************
*** 9196,9202 ****
                                          "xmlXPathRunEval: function %s not found\n",
                                          op->value4);
                          XP_ERROR0(XPATH_UNKNOWN_FUNC_ERROR);
!                         return (total);
                      }
                      op->cache = (void *) func;
                      op->cacheURI = (void *) URI;
--- 9196,9202 ----
                                          "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 -c libxml2-2.4.5/xpointer.c ../libxml2-2.4.5/xpointer.c
*** libxml2-2.4.5/xpointer.c    Fri Aug 17 03:35:06 2001
--- ../libxml2-2.4.5/xpointer.c Fri Oct  5 15:21:51 2001
***************
*** 2027,2035 ****
                                           xmlXPtrGetArity(node)));
                }
                default:
!                   return(NULL);
            }
!           return(NULL);
        }
          case XPATH_RANGE: {
            xmlNodePtr node = (xmlNodePtr) loc->user;
--- 2027,2035 ----
                                           xmlXPtrGetArity(node)));
                }
                default:
!                       return(NULL);
            }
! /*        return(NULL); */
        }
          case XPATH_RANGE: {
            xmlNodePtr node = (xmlNodePtr) loc->user;
***************
*** 2066,2072 ****
                    default:
                        return(NULL);
                }
!               return(NULL);
            }
          }
        default:
--- 2066,2072 ----
                    default:
                        return(NULL);
                }
! /*            return(NULL); */
            }
          }
        default:
***************
*** 2631,2637 ****
        default:
            return(-1);
      }
!     return(-1);
  }
  
  /**
--- 2631,2637 ----
        default:
            return(-1);
      }
! /*     return(-1); */
  }
  
  /**
***************
*** 2667,2673 ****
        default:
            return(-1);
      }
!     return(-1);
  }
  
  /**
--- 2667,2673 ----
        default:
            return(-1);
      }
! /*     return(-1); */
  }
  
  /**
diff -c libxml2-2.4.5/include/libxml/Makefile ../libxml2-2.4.5/include/libxml/Makefile
*** libxml2-2.4.5/include/libxml/Makefile       Thu Oct 11 10:55:57 2001
--- ../libxml2-2.4.5/include/libxml/Makefile    Wed Sep 19 16:47:35 2001
***************
*** 62,68 ****
  AS = @AS@
  CATALOG_OBJ = catalog.o
  CC = cc
! CFLAGS = 
  CPP = cc -E
  DEBUG_OBJ = debugXML.o
  DLLTOOL = @DLLTOOL@
--- 62,68 ----
  AS = @AS@
  CATALOG_OBJ = catalog.o
  CC = cc
! CFLAGS = -g
  CPP = cc -E
  DEBUG_OBJ = debugXML.o
  DLLTOOL = @DLLTOOL@
***************
*** 85,91 ****
  LIBXML_VERSION_NUMBER = 20405
  LN_S = ln -s
  MAINT = #
! MAKEINFO = /home/garyp/LIB_XML_BUILD/TEMP/libxml2-2.4.5/missing makeinfo
  MV = /usr/bin/mv
  M_LIBS = 
  OBJDUMP = @OBJDUMP@
--- 85,91 ----
  LIBXML_VERSION_NUMBER = 20405
  LN_S = ln -s
  MAINT = #
! MAKEINFO = /home/garyp/LIB_XML_BUILD/libxml2-2.4.5/missing makeinfo
  MV = /usr/bin/mv
  M_LIBS = 
  OBJDUMP = @OBJDUMP@
Only in ../libxml2-2.4.5/include/libxml: global_functions.h
Only in ../libxml2-2.4.5/include/libxml: global_utils.h
diff -c libxml2-2.4.5/include/libxml/parser.h ../libxml2-2.4.5/include/libxml/parser.h
*** libxml2-2.4.5/include/libxml/parser.h       Thu Aug 23 03:35:38 2001
--- ../libxml2-2.4.5/include/libxml/parser.h    Thu Oct 11 16:28:47 2001
***************
*** 13,20 ****
  #include <libxml/valid.h>
  #include <libxml/xmlIO.h>
  #include <libxml/entities.h>
  
- 
  #ifdef __cplusplus
  extern "C" {
  #endif
--- 13,22 ----
  #include <libxml/valid.h>
  #include <libxml/xmlIO.h>
  #include <libxml/entities.h>
+ #if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
+ #include <pthread.h>
+ #endif
  
  #ifdef __cplusplus
  extern "C" {
  #endif
***************
*** 145,150 ****
--- 147,155 ----
  typedef struct _xmlParserCtxt xmlParserCtxt;
  typedef xmlParserCtxt *xmlParserCtxtPtr;
  struct _xmlParserCtxt {
+ #if defined(_REENTRANT) || (POSIX_C_SOURCE - 0 >= 199506L)
+       pthread_mutex_t lock;
+ #endif
      struct _xmlSAXHandler *sax;       /* The SAX handler */
      void            *userData;        /* For SAX interface only, used by DOM build */
      xmlDocPtr           myDoc;        /* the document being built */
***************
*** 319,324 ****
--- 324,330 ----
      getParameterEntitySAXFunc getParameterEntity;
      cdataBlockSAXFunc cdataBlock;
      externalSubsetSAXFunc externalSubset;
+       int initialized;
  };
  
  /**
***************
*** 567,572 ****
--- 573,584 ----
                xmlLoadExternalEntity   (const char *URL,
                                         const char *ID,
                                         xmlParserCtxtPtr context);
+ #include <libxml/global_functions.h>
+ /*
+  * Parser Locking
+  */
+ int   xmlLockContext(xmlParserCtxtPtr ctxt);
+ int   xmlUnlockContext(xmlParserCtxtPtr ctxt);
  
  #ifdef __cplusplus
  }
diff -c libxml2-2.4.5/include/libxml/tree.h ../libxml2-2.4.5/include/libxml/tree.h
*** libxml2-2.4.5/include/libxml/tree.h Wed Aug 29 03:35:06 2001
--- ../libxml2-2.4.5/include/libxml/tree.h      Fri Oct  5 11:50:16 2001
***************
*** 25,30 ****
--- 25,32 ----
  extern "C" {
  #endif
  
+ #define BASE_BUFFER_SIZE 4000
+ 
  /**
   * XML_XML_NAMESPACE:
   *
/*
 * Automatically generated by build_glob.py.
 */

#include <libxml/global_utils.h>
#include <libxml/global_functions.h>


extern xmlSAXHandler docbDefaultSAXHandler;
#undef  docbDefaultSAXHandler
xmlSAXHandler *
__docbDefaultSAXHandler(void){
        if (THR_MAIN(pthread_self()))
                return (&docbDefaultSAXHandler);
        else
                return (&get_glob_struct()->docbDefaultSAXHandler);
}

extern xmlSAXHandler htmlDefaultSAXHandler;
#undef  htmlDefaultSAXHandler
xmlSAXHandler *
__htmlDefaultSAXHandler(void){
        if (THR_MAIN(pthread_self()))
                return (&htmlDefaultSAXHandler);
        else
                return (&get_glob_struct()->htmlDefaultSAXHandler);
}

extern int oldXMLWDcompatibility;
#undef  oldXMLWDcompatibility
int *
__oldXMLWDcompatibility(void){
        if (THR_MAIN(pthread_self()))
                return (&oldXMLWDcompatibility);
        else
                return (&get_glob_struct()->oldXMLWDcompatibility);
}

extern xmlBufferAllocationScheme xmlBufferAllocScheme;
#undef  xmlBufferAllocScheme
xmlBufferAllocationScheme *
__xmlBufferAllocScheme(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlBufferAllocScheme);
        else
                return (&get_glob_struct()->xmlBufferAllocScheme);
}

extern int xmlDefaultBufferSize;
#undef  xmlDefaultBufferSize
int *
__xmlDefaultBufferSize(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlDefaultBufferSize);
        else
                return (&get_glob_struct()->xmlDefaultBufferSize);
}

extern xmlSAXHandler xmlDefaultSAXHandler;
#undef  xmlDefaultSAXHandler
xmlSAXHandler *
__xmlDefaultSAXHandler(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlDefaultSAXHandler);
        else
                return (&get_glob_struct()->xmlDefaultSAXHandler);
}

extern xmlSAXLocator xmlDefaultSAXLocator;
#undef  xmlDefaultSAXLocator
xmlSAXLocator *
__xmlDefaultSAXLocator(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlDefaultSAXLocator);
        else
                return (&get_glob_struct()->xmlDefaultSAXLocator);
}

extern int xmlDoValidityCheckingDefaultValue;
#undef  xmlDoValidityCheckingDefaultValue
int *
__xmlDoValidityCheckingDefaultValue(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlDoValidityCheckingDefaultValue);
        else
                return (&get_glob_struct()->xmlDoValidityCheckingDefaultValue);
}

extern xmlFreeFunc xmlFree;
#undef  xmlFree
xmlFreeFunc *
__xmlFree(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlFree);
        else
                return (&get_glob_struct()->xmlFree);
}

extern xmlGenericErrorFunc xmlGenericError;
#undef  xmlGenericError
xmlGenericErrorFunc *
__xmlGenericError(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlGenericError);
        else
                return (&get_glob_struct()->xmlGenericError);
}

extern void * xmlGenericErrorContext;
#undef  xmlGenericErrorContext
void * *
__xmlGenericErrorContext(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlGenericErrorContext);
        else
                return (&get_glob_struct()->xmlGenericErrorContext);
}

extern int xmlGetWarningsDefaultValue;
#undef  xmlGetWarningsDefaultValue
int *
__xmlGetWarningsDefaultValue(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlGetWarningsDefaultValue);
        else
                return (&get_glob_struct()->xmlGetWarningsDefaultValue);
}

extern int xmlIndentTreeOutput;
#undef  xmlIndentTreeOutput
int *
__xmlIndentTreeOutput(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlIndentTreeOutput);
        else
                return (&get_glob_struct()->xmlIndentTreeOutput);
}

extern int xmlKeepBlanksDefaultValue;
#undef  xmlKeepBlanksDefaultValue
int *
__xmlKeepBlanksDefaultValue(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlKeepBlanksDefaultValue);
        else
                return (&get_glob_struct()->xmlKeepBlanksDefaultValue);
}

extern int xmlLineNumbersDefaultValue;
#undef  xmlLineNumbersDefaultValue
int *
__xmlLineNumbersDefaultValue(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlLineNumbersDefaultValue);
        else
                return (&get_glob_struct()->xmlLineNumbersDefaultValue);
}

extern int xmlLoadExtDtdDefaultValue;
#undef  xmlLoadExtDtdDefaultValue
int *
__xmlLoadExtDtdDefaultValue(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlLoadExtDtdDefaultValue);
        else
                return (&get_glob_struct()->xmlLoadExtDtdDefaultValue);
}

extern xmlMallocFunc xmlMalloc;
#undef  xmlMalloc
xmlMallocFunc *
__xmlMalloc(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlMalloc);
        else
                return (&get_glob_struct()->xmlMalloc);
}

extern xmlStrdupFunc xmlMemStrdup;
#undef  xmlMemStrdup
xmlStrdupFunc *
__xmlMemStrdup(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlMemStrdup);
        else
                return (&get_glob_struct()->xmlMemStrdup);
}

extern int xmlParserDebugEntities;
#undef  xmlParserDebugEntities
int *
__xmlParserDebugEntities(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlParserDebugEntities);
        else
                return (&get_glob_struct()->xmlParserDebugEntities);
}

extern const char * xmlParserVersion;
#undef  xmlParserVersion
const char * *
__xmlParserVersion(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlParserVersion);
        else
                return (&get_glob_struct()->xmlParserVersion);
}

extern int xmlPedanticParserDefaultValue;
#undef  xmlPedanticParserDefaultValue
int *
__xmlPedanticParserDefaultValue(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlPedanticParserDefaultValue);
        else
                return (&get_glob_struct()->xmlPedanticParserDefaultValue);
}

extern xmlReallocFunc xmlRealloc;
#undef  xmlRealloc
xmlReallocFunc *
__xmlRealloc(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlRealloc);
        else
                return (&get_glob_struct()->xmlRealloc);
}

extern int xmlSaveNoEmptyTags;
#undef  xmlSaveNoEmptyTags
int *
__xmlSaveNoEmptyTags(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlSaveNoEmptyTags);
        else
                return (&get_glob_struct()->xmlSaveNoEmptyTags);
}

extern int xmlSubstituteEntitiesDefaultValue;
#undef  xmlSubstituteEntitiesDefaultValue
int *
__xmlSubstituteEntitiesDefaultValue(void){
        if (THR_MAIN(pthread_self()))
                return (&xmlSubstituteEntitiesDefaultValue);
        else
                return (&get_glob_struct()->xmlSubstituteEntitiesDefaultValue);
}
#include <stdlib.h>
#include <pthread.h>
#if defined(SOLARIS)
#include <note.h>
#endif
#include <string.h>
#include <libxml/global_utils.h>

/*
 * module global data
 */
static pthread_mutex_t  keylock;
static pthread_key_t    globalkey;
static int              keyonce = 0;
static token_r_t        *lib_lock = NULL;
#if defined(SOLARIS)
NOTE(DATA_READABLE_WITHOUT_LOCK(keyonce))
#endif

/*
 * utility functions
 */
static void                     tsd_free(void *v);
static xml2_global              *alloc_glob_struct(void);

/*
 * tsd_free() is called when a thread terminates with a non-NULL
 * TSD. It is is used here to reclaim memory resources.
 */
static void
tsd_free(void *v)
{
        free(v);
}

/*
 * alloc_glob_struct() allocates a global structure. This structure is used to
 * hold all data for use by a thread when supporting backwards compatibility
 * of libmxml2 to pre-thread-safe behaviour.
 */
static xml2_global *
alloc_glob_struct(void)
{
        xml2_global *gs = malloc(sizeof (xml2_global));
        memset(gs, 0, sizeof (gs));
        /*
         * Perform initialisation as required by libxml
         */
        initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
        inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
        gs->oldXMLWDcompatibility = 0;
        gs->xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
        gs->xmlDefaultBufferSize = BASE_BUFFER_SIZE;
        initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
        gs->xmlDefaultSAXLocator.getPublicId = getPublicId;
        gs->xmlDefaultSAXLocator.getSystemId = getSystemId;
        gs->xmlDefaultSAXLocator.getLineNumber = getLineNumber;
        gs->xmlDefaultSAXLocator.getColumnNumber = getColumnNumber;
        gs->xmlDoValidityCheckingDefaultValue = 0;
#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
        gs->xmlFree = (xmlFreeFunc) xmlMemFree;
        gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
        gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
        gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
#else
        gs->xmlFree = (xmlFreeFunc) free;
        gs->xmlMalloc = (xmlMallocFunc) malloc;
        gs->xmlRealloc = (xmlReallocFunc) realloc;
        gs->xmlMemStrdup = (xmlStrdupFunc) strdup;
#endif
        initGenericErrorDefaultFunc(&gs->xmlGenericError);
        gs->xmlGenericErrorContext = NULL;
        gs->xmlGetWarningsDefaultValue = 1;
        gs->xmlIndentTreeOutput = 0;
        gs->xmlKeepBlanksDefaultValue = 1;
        gs->xmlLineNumbersDefaultValue = 0;
        gs->xmlLoadExtDtdDefaultValue = 0;
        gs->xmlParserDebugEntities = 0;
        gs->xmlParserVersion = LIBXML_VERSION_STRING;
        gs->xmlPedanticParserDefaultValue = 0;
        gs->xmlSaveNoEmptyTags = 0;
/*      snprintf((char *)gs->xmlStringComment, sizeof (gs->xmlStringComment), */
/*          "comment"); */
/*      snprintf((char *)gs->xmlStringText, sizeof (gs->xmlStringText), */
/*          "text"); */
/*      snprintf((char *)gs->xmlStringTextNoenc, */
/*          sizeof (gs->xmlStringTextNoenc), "textnoenc"); */
        gs->xmlSubstituteEntitiesDefaultValue = 0;

        return (gs);
}

/*
 * get_glob_struct() is called to retrieve the TSD for a thread. Note that it
 * should not be called for the "main" thread as this thread uses the existing
 * global variables defined in the library. keyonce will only be set once
 * during a library invocation and is used to create globalkey, the key used
 * to store each thread's TSD.
 */
struct _xml2_global *
get_glob_struct(void)
{
        xml2_global *globalval;

        if (keyonce == 0) {
                (void) pthread_mutex_lock(&keylock);
                if (keyonce == 0) {
                        keyonce++;
                        (void) pthread_key_create(&globalkey, tsd_free);
                }
                (void) pthread_mutex_unlock(&keylock);
        }
        if ((globalval = (xml2_global *)pthread_getspecific(globalkey))
            == NULL) {
                xml2_global *tsd = alloc_glob_struct();
                pthread_setspecific(globalkey, tsd);
                return (tsd);
        } else
                return (globalval);
}

/*
 * A wrapper for a pthread_mutex_t that can be overriden on platforms that
 * don't support mutexes.
 */
struct token
{
        pthread_mutex_t c_lock;
};

/*
 * A re-entrant lock which is implemented using pthread condition variables
 * and mutexes. It could be made more portable.
 */
struct token_r
{
        pthread_mutex_t c_lock;
        unsigned int    c_held;
        unsigned int    c_waiters;
        pthread_t       c_tid;
        pthread_cond_t  c_cv;
};

/*
 * token_alloc() is used to allocate a libxml2 token struct for use in
 * synchronizing access to data.
 */
token_t *
token_alloc(void)
{
        token_t *tok;

        if ((tok = malloc(sizeof (token_t))) == NULL)
                return (NULL);
        pthread_mutex_init(&tok->c_lock, NULL);
        return (tok);
}

/*
 * token_free() is used to reclaim resources associated with a libxml2 token
 * struct.
 */
void
token_free(token_t *tok)
{
        pthread_mutex_destroy(&tok->c_lock);
        free(tok);
}

/*
 * token_lock() is used to lock a libxml2 token.
 */
void
token_lock(token_t *tok)
{
        pthread_mutex_lock(&tok->c_lock);

}

/*
 * token_unlock() is used to unlock a libxml2 token.
 */
void
token_unlock(token_t *tok)
{

        pthread_mutex_unlock(&tok->c_lock);
}

/*
 * token_r_alloc() is used to allocate a libxml2 token_R struct for use in
 * synchronizing access to data. token_r is a re-entrant lock and thus useful
 * for synchronizing access to data structures that may be manipulated in a
 * recursive fashion.
 */
token_r_t *
token_r_alloc(void)
{
        token_r_t *tok;

        if ((tok = malloc(sizeof (token_r_t))) == NULL)
                return (NULL);
        pthread_mutex_init(&tok->c_lock, NULL);
        return (tok);
}

/*
 * token_r_free() is used to reclaim resources associated with a libxml2
 * token_r struct.
 */
void
token_r_free(token_r_t *tok)
{
        pthread_mutex_destroy(&tok->c_lock);
        free(tok);
}

/*
 * token_r_lock() is used to lock a libxml2 token_r.
 */
void
token_r_lock(token_r_t *tok)
{
        pthread_mutex_lock(&tok->c_lock);
        if (tok->c_held) {
                if (pthread_equal(tok->c_tid, pthread_self())) {
                        tok->c_held++;
                        pthread_mutex_unlock(&tok->c_lock);
                        return;
                } else {
                        tok->c_waiters++;
                        while (tok->c_held)
                                pthread_cond_wait(&tok->c_cv, &tok->c_lock);
                        tok->c_waiters--;
                }
        }
        tok->c_tid = pthread_self();
        tok->c_held = 1;
        pthread_mutex_unlock(&tok->c_lock);
}

/*
 * token_r_unlock() is used to unlock a libxml2 token_r.
 */
void
token_r_unlock(token_r_t *tok)
{
        pthread_mutex_lock(&tok->c_lock);
        tok->c_held--;
        if (tok->c_held == 0) {
                if (tok->c_waiters)
                        pthread_cond_signal(&tok->c_cv);
                tok->c_tid = 0;
        }
        pthread_mutex_unlock(&tok->c_lock);
}

/*
 * xmlLockLibrary() is used to take out a re-entrant lock on the libxml2
 * library.
 */
void
xmlLockLibrary()
{
        token_r_lock(lib_lock);
}

/*
 * xmlUnlockLibrary() is used to release a re-entrant lock on the libxml2
 * library.
 */
void
xmlUnlockLibrary()
{
        token_r_unlock(lib_lock);
}

/*
 * lib_lock_alloc() is used to allocate a re-entrant lock on the libxml2
 * library.
 */
void
lib_lock_alloc()
{
        lib_lock = token_r_alloc();
}

/*
 * lib_lock_alloc() is used to free a re-entrant lock on the libxml2
 * library.
 */
void
lib_lock_free()
{
        token_r_free(lib_lock);
}
/*
 * Relocated global variables
 */

#ifdef LIBXML_DOCB_ENABLED
/*
 * Default handler for SGML DocBook, builds the DOM tree
 */
xmlSAXHandler docbDefaultSAXHandler = {
    internalSubset,
    isStandalone,
    hasInternalSubset,
    hasExternalSubset,
    resolveEntity,
    getEntity,
    entityDecl,
    NULL,
    NULL,
    NULL,
    NULL,
    setDocumentLocator,
    startDocument,
    endDocument,
    startElement,
    endElement,
    reference,
    characters,
    ignorableWhitespace,
    NULL,
    comment,
    xmlParserWarning,
    xmlParserError,
    xmlParserError,
    getParameterEntity,
    NULL,
    NULL,
    0
};
#endif /* LIBXML_DOCB_ENABLED */

#ifdef LIBXML_HTML_ENABLED
/*
 * Default handler for HTML, builds the DOM tree
 */
xmlSAXHandler htmlDefaultSAXHandler = {
    internalSubset,
    NULL,
    NULL,
    NULL,
    NULL,
    getEntity,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    setDocumentLocator,
    startDocument,
    endDocument,
    startElement,
    endElement,
    NULL,
    characters,
    ignorableWhitespace,
    NULL,
    comment,
    xmlParserWarning,
    xmlParserError,
    xmlParserError,
    getParameterEntity,
    cdataBlock,
    NULL,
    0
};
#endif /* LIBXML_HTML_ENABLED */

/************************************************************************
 *                                  *
 *          Deprecated                  *
 *                                  *
 ************************************************************************/
int oldXMLWDcompatibility = 0;
xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
/*
 * Default handler for XML, builds the DOM tree
 */
xmlSAXHandler xmlDefaultSAXHandler = {
    internalSubset,
    isStandalone,
    hasInternalSubset,
    hasExternalSubset,
    resolveEntity,
    getEntity,
    entityDecl,
    notationDecl,
    attributeDecl,
    elementDecl,
    unparsedEntityDecl,
    setDocumentLocator,
    startDocument,
    endDocument,
    startElement,
    endElement,
    reference,
    characters,
    characters,
    processingInstruction,
    comment,
    xmlParserWarning,
    xmlParserError,
    xmlParserError,
    getParameterEntity,
    cdataBlock,
    externalSubset,
    0
};

/*
 * The default SAX Locator.
 */

xmlSAXLocator xmlDefaultSAXLocator = {
    getPublicId, getSystemId, getLineNumber, getColumnNumber
};

int xmlDoValidityCheckingDefaultValue = 0;

#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
#else
xmlFreeFunc xmlFree = (xmlFreeFunc) free;
xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) strdup;
#endif

/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
/* Must initialize xmlGenericError in xmlInitParser */
xmlGenericErrorFunc xmlGenericError;
void *xmlGenericErrorContext = NULL;

int xmlGetWarningsDefaultValue = 1;

int xmlIndentTreeOutput = 0;

int xmlLoadExtDtdDefaultValue = 0;
int xmlPedanticParserDefaultValue = 0;
int xmlLineNumbersDefaultValue = 0;
int xmlKeepBlanksDefaultValue = 1;

/*
 * Various global defaults for parsing
 */
int xmlParserDebugEntities = 0;

/************************************************************************
 *                                  *
 *      Version and Features handling               *
 *                                  *
 ************************************************************************/
const char *xmlParserVersion = LIBXML_VERSION_STRING;

int xmlSaveNoEmptyTags = 0;

int xmlSubstituteEntitiesDefaultValue = 0;
/*
 * Automatically generated by build_glob.py.
 */
#ifndef __XML_GLOBAL_FUNCTION_H
#define __XML_GLOBAL_FUNCTION_H

#include <libxml/parser.h>
#include <libxml/xmlerror.h>

#ifdef __cplusplus
extern "C" {
#endif


#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern xmlSAXHandler *__docbDefaultSAXHandler();
#define docbDefaultSAXHandler \
(*(__docbDefaultSAXHandler()))
#else
extern xmlSAXHandler docbDefaultSAXHandler;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern xmlSAXHandler *__htmlDefaultSAXHandler();
#define htmlDefaultSAXHandler \
(*(__htmlDefaultSAXHandler()))
#else
extern xmlSAXHandler htmlDefaultSAXHandler;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__oldXMLWDcompatibility();
#define oldXMLWDcompatibility \
(*(__oldXMLWDcompatibility()))
#else
extern int oldXMLWDcompatibility;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern xmlBufferAllocationScheme *__xmlBufferAllocScheme();
#define xmlBufferAllocScheme \
(*(__xmlBufferAllocScheme()))
#else
extern xmlBufferAllocationScheme xmlBufferAllocScheme;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__xmlDefaultBufferSize();
#define xmlDefaultBufferSize \
(*(__xmlDefaultBufferSize()))
#else
extern int xmlDefaultBufferSize;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern xmlSAXHandler *__xmlDefaultSAXHandler();
#define xmlDefaultSAXHandler \
(*(__xmlDefaultSAXHandler()))
#else
extern xmlSAXHandler xmlDefaultSAXHandler;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern xmlSAXLocator *__xmlDefaultSAXLocator();
#define xmlDefaultSAXLocator \
(*(__xmlDefaultSAXLocator()))
#else
extern xmlSAXLocator xmlDefaultSAXLocator;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__xmlDoValidityCheckingDefaultValue();
#define xmlDoValidityCheckingDefaultValue \
(*(__xmlDoValidityCheckingDefaultValue()))
#else
extern int xmlDoValidityCheckingDefaultValue;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern xmlFreeFunc *__xmlFree();
#define xmlFree \
(*(__xmlFree()))
#else
extern xmlFreeFunc xmlFree;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern xmlGenericErrorFunc *__xmlGenericError();
#define xmlGenericError \
(*(__xmlGenericError()))
#else
extern xmlGenericErrorFunc xmlGenericError;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern void * *__xmlGenericErrorContext();
#define xmlGenericErrorContext \
(*(__xmlGenericErrorContext()))
#else
extern void * xmlGenericErrorContext;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__xmlGetWarningsDefaultValue();
#define xmlGetWarningsDefaultValue \
(*(__xmlGetWarningsDefaultValue()))
#else
extern int xmlGetWarningsDefaultValue;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__xmlIndentTreeOutput();
#define xmlIndentTreeOutput \
(*(__xmlIndentTreeOutput()))
#else
extern int xmlIndentTreeOutput;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__xmlKeepBlanksDefaultValue();
#define xmlKeepBlanksDefaultValue \
(*(__xmlKeepBlanksDefaultValue()))
#else
extern int xmlKeepBlanksDefaultValue;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__xmlLineNumbersDefaultValue();
#define xmlLineNumbersDefaultValue \
(*(__xmlLineNumbersDefaultValue()))
#else
extern int xmlLineNumbersDefaultValue;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__xmlLoadExtDtdDefaultValue();
#define xmlLoadExtDtdDefaultValue \
(*(__xmlLoadExtDtdDefaultValue()))
#else
extern int xmlLoadExtDtdDefaultValue;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern xmlMallocFunc *__xmlMalloc();
#define xmlMalloc \
(*(__xmlMalloc()))
#else
extern xmlMallocFunc xmlMalloc;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern xmlStrdupFunc *__xmlMemStrdup();
#define xmlMemStrdup \
(*(__xmlMemStrdup()))
#else
extern xmlStrdupFunc xmlMemStrdup;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__xmlParserDebugEntities();
#define xmlParserDebugEntities \
(*(__xmlParserDebugEntities()))
#else
extern int xmlParserDebugEntities;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern const char * *__xmlParserVersion();
#define xmlParserVersion \
(*(__xmlParserVersion()))
#else
extern const char * xmlParserVersion;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__xmlPedanticParserDefaultValue();
#define xmlPedanticParserDefaultValue \
(*(__xmlPedanticParserDefaultValue()))
#else
extern int xmlPedanticParserDefaultValue;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern xmlReallocFunc *__xmlRealloc();
#define xmlRealloc \
(*(__xmlRealloc()))
#else
extern xmlReallocFunc xmlRealloc;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__xmlSaveNoEmptyTags();
#define xmlSaveNoEmptyTags \
(*(__xmlSaveNoEmptyTags()))
#else
extern int xmlSaveNoEmptyTags;
#endif

#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
extern int *__xmlSubstituteEntitiesDefaultValue();
#define xmlSubstituteEntitiesDefaultValue \
(*(__xmlSubstituteEntitiesDefaultValue()))
#else
extern int xmlSubstituteEntitiesDefaultValue;
#endif

#ifdef __cplusplus
}
#endif

#endif
#include <libxml/parser.h>
#include <libxml/SAX.h>
/*
 * Helpful Macro
 */
#if defined(SOLARIS)
#define THR_MAIN(tid) (-1 == thr_main() || tid == thr_main())
#else
#define THR_MAIN(tid) (tid == 0 || tid == 1024)
#endif

/*
 * Externally global symbols which need to be protected for backwards
 * compatibility support.
 */
#undef  docbDefaultSAXHandler
#undef  htmlDefaultSAXHandler
#undef  oldXMLWDcompatibility
#undef  xmlBufferAllocScheme
#undef  xmlDefaultBufferSize
#undef  xmlDefaultSAXHandler
#undef  xmlDefaultSAXLocator
#undef  xmlDoValidityCheckingDefaultValue
#undef  xmlFree
#undef  xmlGenericError
#undef  xmlGenericErrorContext
#undef  xmlGetWarningsDefaultValue
#undef  xmlIndentTreeOutput
#undef  xmlKeepBlanksDefaultValue
#undef  xmlLineNumbersDefaultValue
#undef  xmlLoadExtDtdDefaultValue
#undef  xmlMalloc
#undef  xmlMemStrdup
#undef  xmlParserDebugEntities
#undef  xmlParserVersion
#undef  xmlPedanticParserDefaultValue
#undef  xmlRealloc
#undef  xmlSaveNoEmptyTags
/* #undef       xmlStringComment */
/* #undef       xmlStringText */
/* #undef       xmlStringTextNoenc */
#undef  xmlSubstituteEntitiesDefaultValue

struct _xml2_global 
{
        xmlSAXHandler docbDefaultSAXHandler;
        xmlSAXHandler htmlDefaultSAXHandler;
        int oldXMLWDcompatibility;
        xmlBufferAllocationScheme xmlBufferAllocScheme;
        int xmlDefaultBufferSize;
        xmlSAXHandler xmlDefaultSAXHandler;
        xmlSAXLocator xmlDefaultSAXLocator;
        int xmlDoValidityCheckingDefaultValue;
        xmlFreeFunc xmlFree;
        xmlGenericErrorFunc xmlGenericError;
        void *xmlGenericErrorContext;
        int xmlGetWarningsDefaultValue;
        int xmlIndentTreeOutput;
        int xmlKeepBlanksDefaultValue;
        int xmlLineNumbersDefaultValue;
        int xmlLoadExtDtdDefaultValue;
        xmlMallocFunc xmlMalloc;
        xmlStrdupFunc xmlMemStrdup;
        int xmlParserDebugEntities;
        const char *xmlParserVersion;
        int xmlPedanticParserDefaultValue;
        xmlReallocFunc xmlRealloc;
        int xmlSaveNoEmptyTags;
/*      const xmlChar xmlStringComment[8]; */
/*      const xmlChar xmlStringText[5]; */
/*      const xmlChar xmlStringTextNoenc[10]; */
        int xmlSubstituteEntitiesDefaultValue;
};

typedef struct token token_t;
typedef struct token_r token_r_t;
typedef struct _xml2_global xml2_global;

struct _xml2_global                     *get_glob_struct(void);
token_t                                 *token_alloc(void);
void                                    token_free(token_t *tok);
void                                    token_lock(token_t *tok);
void                                    token_unlock(token_t *tok);
token_r_t                               *token_r_alloc(void);
void                                    token_r_free(token_r_t *tok);
void                                    token_r_lock(token_r_t *tok);
void                                    token_r_unlock(token_r_t *tok);

void                                    xmlLockLibrary();
void                                    xmlUnlockLibrary();
#include <stdlib.h>
#include <libxml/parser.h>
#include <unistd.h>

extern int xmlDoValidityCheckingDefaultValue;

int
main(int argc, char **argv)
{
        printf("xmlDoValidityCheckingDefaultValue=%d\n",
            xmlDoValidityCheckingDefaultValue);
        xmlDoValidityCheckingDefaultValue = 1;
        printf("xmlDoValidityCheckingDefaultValue=%d\n",
            xmlDoValidityCheckingDefaultValue);
        if (xmlParseFile("poolcfg") == NULL)
                printf("parse failed\n");
        return (0);
}
#include <stdlib.h>
#include <libxml/parser.h>
#include <pthread.h>
#include <unistd.h>
#include <assert.h>

void *thread_specific_data();
#define MAX_ARGC        20
pthread_t tid[MAX_ARGC];
int num_threads;

/* extern int xmlDoValidityCheckingDefaultValue; */

int
main(int argc, char **argv)
{
        int i;
        num_threads = argc - 1;

        xmlInitParser();
        for (i = 0; i < num_threads; i++)
                pthread_create(&tid[i], 0, thread_specific_data, (void *)argv[i+1]);
        for (i = 0; i < num_threads; i++)
                pthread_join(tid[i], NULL);

        return (0);
}

void *
thread_specific_data(const char *private_data)
{
        xmlDocPtr myDoc;

        xmlLockLibrary();       /* Lock libxml2 */

        xmlLoadCatalog(private_data);
        xmlCatalogDump(stdout);

        if (strcmp(private_data, "catalogs/registry.xml") == 0) {
                printf("validating\n");
                xmlDoValidityCheckingDefaultValue=1;
                xmlGenericErrorContext = stdout;
        }
        printf("validating is %d\n", xmlDoValidityCheckingDefaultValue);
        printf("xmlDoValidityCheckingDefaultValue is %d\n", xmlDoValidityCheckingDefaultValue);
        myDoc = xmlParseFile("poolcfg");
        if (myDoc) {
                int len;
                xmlChar *result;
                /* xmlDocDumpFormatMemory(myDoc, &result, &len, 1); */
                write(1, result, len);
                xmlFreeDoc(myDoc);
        } else
                printf("parse failed\n");
        xmlUnlockLibrary();     /* Unlock libxml2 */
        return (NULL);
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]