1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

Applied the last patches from Gary, cleanup, activated threading all user

* include/libxml/SAX.h include/libxml/globals.h include/libxml/parser.h
  include/libxml/parserInternals.h include/libxml/tree.h
  include/libxml/xmlerror.h HTMLparser.c SAX.c error.c globals.c
  nanoftp.c nanohttp.c parser.c parserInternals.c testDocbook.c
  testHTML.c testSAX.c tree.c uri.c xlink.c xmlmemory.c:
  Applied the last patches from Gary, cleanup, activated threading
  all user accessible global variables are now handled in globals.[ch]
  Still a bit rought but make tests passes with either
  --with-threads defined at configure time or not.
* Makefile.am example/Makefile.am: added globals.[ch] and threads
  linking options
Daniel
This commit is contained in:
Daniel Veillard
2001-10-13 09:15:48 +00:00
parent b847864fc2
commit d046356030
25 changed files with 323 additions and 365 deletions

View File

@ -1,3 +1,17 @@
Sat Oct 13 11:08:20 CEST 2001 Daniel Veillard <daniel@veillard.com>
* include/libxml/SAX.h include/libxml/globals.h include/libxml/parser.h
include/libxml/parserInternals.h include/libxml/tree.h
include/libxml/xmlerror.h HTMLparser.c SAX.c error.c globals.c
nanoftp.c nanohttp.c parser.c parserInternals.c testDocbook.c
testHTML.c testSAX.c tree.c uri.c xlink.c xmlmemory.c:
Applied the last patches from Gary, cleanup, activated threading
all user accessible global variables are now handled in globals.[ch]
Still a bit rought but make tests passes with either
--with-threads defined at configure time or not.
* Makefile.am example/Makefile.am: added globals.[ch] and threads
linking options
Fri Oct 12 19:25:55 CEST 2001 Daniel Veillard <daniel@veillard.com> Fri Oct 12 19:25:55 CEST 2001 Daniel Veillard <daniel@veillard.com>
* Makefile.am include/libxml/Makefile.am * Makefile.am include/libxml/Makefile.am

View File

@ -3557,6 +3557,8 @@ static int
htmlParseDocument(htmlParserCtxtPtr ctxt) { htmlParseDocument(htmlParserCtxtPtr ctxt) {
xmlDtdPtr dtd; xmlDtdPtr dtd;
xmlInitParser();
htmlDefaultSAXHandlerInit(); htmlDefaultSAXHandlerInit();
ctxt->html = 1; ctxt->html = 1;
@ -4669,6 +4671,8 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
htmlParserInputPtr inputStream; htmlParserInputPtr inputStream;
xmlParserInputBufferPtr buf; xmlParserInputBufferPtr buf;
xmlInitParser();
buf = xmlAllocParserInputBuffer(enc); buf = xmlAllocParserInputBuffer(enc);
if (buf == NULL) return(NULL); if (buf == NULL) return(NULL);
@ -4745,6 +4749,8 @@ htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void
htmlDocPtr ret; htmlDocPtr ret;
htmlParserCtxtPtr ctxt; htmlParserCtxtPtr ctxt;
xmlInitParser();
if (cur == NULL) return(NULL); if (cur == NULL) return(NULL);
@ -4869,6 +4875,8 @@ htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr s
htmlParserCtxtPtr ctxt; htmlParserCtxtPtr ctxt;
htmlSAXHandlerPtr oldsax = NULL; htmlSAXHandlerPtr oldsax = NULL;
xmlInitParser();
ctxt = htmlCreateFileParserCtxt(filename, encoding); ctxt = htmlCreateFileParserCtxt(filename, encoding);
if (ctxt == NULL) return(NULL); if (ctxt == NULL) return(NULL);
if (sax != NULL) { if (sax != NULL) {

View File

@ -23,14 +23,14 @@ 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 \ 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 \ valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c \
xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c \ xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c \
catalog.c threads.c strio.c trio.c catalog.c globals.c threads.c strio.c trio.c
else else
libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.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 \ 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 \ valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c \
xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c \ xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c \
catalog.c threads.c catalog.c globals.c threads.c
endif endif

330
SAX.c
View File

@ -88,14 +88,6 @@ getColumnNumber(void *ctx)
return(ctxt->input->col); return(ctxt->input->col);
} }
/*
* The default SAX Locator.
*/
xmlSAXLocator xmlDefaultSAXLocator = {
getPublicId, getSystemId, getLineNumber, getColumnNumber
};
/** /**
* isStandalone: * isStandalone:
* @ctx: the user data (XML parser context) * @ctx: the user data (XML parser context)
@ -1667,38 +1659,51 @@ cdataBlock(void *ctx, const xmlChar *value, int len)
} }
} }
/* /**
* Default handler for XML, builds the DOM tree * xmlDefaultSAXHandlerInit:
*
* Initialize the default SAX handler
*/ */
xmlSAXHandler xmlDefaultSAXHandler = { void
internalSubset, initxmlDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
isStandalone, {
hasInternalSubset, if(hdlr->initialized == 1)
hasExternalSubset, return;
resolveEntity,
getEntity, hdlr->internalSubset = internalSubset;
entityDecl, hdlr->externalSubset = externalSubset;
notationDecl, hdlr->isStandalone = isStandalone;
attributeDecl, hdlr->hasInternalSubset = hasInternalSubset;
elementDecl, hdlr->hasExternalSubset = hasExternalSubset;
unparsedEntityDecl, hdlr->resolveEntity = resolveEntity;
setDocumentLocator, hdlr->getEntity = getEntity;
startDocument, hdlr->getParameterEntity = getParameterEntity;
endDocument, hdlr->entityDecl = entityDecl;
startElement, hdlr->attributeDecl = attributeDecl;
endElement, hdlr->elementDecl = elementDecl;
reference, hdlr->notationDecl = notationDecl;
characters, hdlr->unparsedEntityDecl = unparsedEntityDecl;
characters, hdlr->setDocumentLocator = setDocumentLocator;
processingInstruction, hdlr->startDocument = startDocument;
comment, hdlr->endDocument = endDocument;
xmlParserWarning, hdlr->startElement = startElement;
xmlParserError, hdlr->endElement = endElement;
xmlParserError, hdlr->reference = reference;
getParameterEntity, hdlr->characters = characters;
cdataBlock, hdlr->cdataBlock = cdataBlock;
externalSubset, 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: * xmlDefaultSAXHandlerInit:
@ -1708,77 +1713,52 @@ xmlSAXHandler xmlDefaultSAXHandler = {
void void
xmlDefaultSAXHandlerInit(void) xmlDefaultSAXHandlerInit(void)
{ {
static int xmlSAXInitialized = 0; initxmlDefaultSAXHandler(&xmlDefaultSAXHandler, xmlGetWarningsDefaultValue);
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 #ifdef LIBXML_HTML_ENABLED
/*
* Default handler for HTML, builds the DOM tree /**
* htmlDefaultSAXHandlerInit:
*
* Initialize the default SAX handler
*/ */
xmlSAXHandler htmlDefaultSAXHandler = { void
internalSubset, inithtmlDefaultSAXHandler(xmlSAXHandler *hdlr)
NULL, {
NULL, if(hdlr->initialized == 1)
NULL, return;
NULL,
getEntity, hdlr->internalSubset = internalSubset;
NULL, hdlr->externalSubset = NULL;
NULL, hdlr->isStandalone = NULL;
NULL, hdlr->hasInternalSubset = NULL;
NULL, hdlr->hasExternalSubset = NULL;
NULL, hdlr->resolveEntity = NULL;
setDocumentLocator, hdlr->getEntity = getEntity;
startDocument, hdlr->getParameterEntity = NULL;
endDocument, hdlr->entityDecl = NULL;
startElement, hdlr->attributeDecl = NULL;
endElement, hdlr->elementDecl = NULL;
NULL, hdlr->notationDecl = NULL;
characters, hdlr->unparsedEntityDecl = NULL;
ignorableWhitespace, hdlr->setDocumentLocator = setDocumentLocator;
NULL, hdlr->startDocument = startDocument;
comment, hdlr->endDocument = endDocument;
xmlParserWarning, hdlr->startElement = startElement;
xmlParserError, hdlr->endElement = endElement;
xmlParserError, hdlr->reference = NULL;
getParameterEntity, hdlr->characters = characters;
cdataBlock, hdlr->cdataBlock = cdataBlock;
NULL, hdlr->ignorableWhitespace = ignorableWhitespace;
}; hdlr->processingInstruction = NULL;
hdlr->comment = comment;
hdlr->warning = xmlParserWarning;
hdlr->error = xmlParserError;
hdlr->fatalError = xmlParserError;
hdlr->initialized = 1;
}
/** /**
* htmlDefaultSAXHandlerInit: * htmlDefaultSAXHandlerInit:
@ -1788,75 +1768,49 @@ xmlSAXHandler htmlDefaultSAXHandler = {
void void
htmlDefaultSAXHandlerInit(void) htmlDefaultSAXHandlerInit(void)
{ {
static int htmlSAXInitialized = 0; inithtmlDefaultSAXHandler(&htmlDefaultSAXHandler);
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 */ #endif /* LIBXML_HTML_ENABLED */
#ifdef LIBXML_DOCB_ENABLED #ifdef LIBXML_DOCB_ENABLED
/*
* Default handler for SGML DocBook, builds the DOM tree void
*/ initdocbDefaultSAXHandler(xmlSAXHandler *hdlr)
xmlSAXHandler docbDefaultSAXHandler = { {
internalSubset, if(hdlr->initialized == 1)
isStandalone, return;
hasInternalSubset,
hasExternalSubset, hdlr->internalSubset = internalSubset;
resolveEntity, hdlr->externalSubset = NULL;
getEntity, hdlr->isStandalone = isStandalone;
entityDecl, hdlr->hasInternalSubset = hasInternalSubset;
NULL, hdlr->hasExternalSubset = hasExternalSubset;
NULL, hdlr->resolveEntity = resolveEntity;
NULL, hdlr->getEntity = getEntity;
NULL, hdlr->getParameterEntity = NULL;
setDocumentLocator, hdlr->entityDecl = entityDecl;
startDocument, hdlr->attributeDecl = NULL;
endDocument, hdlr->elementDecl = NULL;
startElement, hdlr->notationDecl = NULL;
endElement, hdlr->unparsedEntityDecl = NULL;
reference, hdlr->setDocumentLocator = setDocumentLocator;
characters, hdlr->startDocument = startDocument;
ignorableWhitespace, hdlr->endDocument = endDocument;
NULL, hdlr->startElement = startElement;
comment, hdlr->endElement = endElement;
xmlParserWarning, hdlr->reference = reference;
xmlParserError, hdlr->characters = characters;
xmlParserError, hdlr->cdataBlock = NULL;
getParameterEntity, hdlr->ignorableWhitespace = ignorableWhitespace;
NULL, hdlr->processingInstruction = NULL;
NULL, hdlr->comment = comment;
}; hdlr->warning = xmlParserWarning;
hdlr->error = xmlParserError;
hdlr->fatalError = xmlParserError;
hdlr->initialized = 1;
}
/** /**
* docbDefaultSAXHandlerInit: * docbDefaultSAXHandlerInit:
@ -1866,39 +1820,7 @@ xmlSAXHandler docbDefaultSAXHandler = {
void void
docbDefaultSAXHandlerInit(void) docbDefaultSAXHandlerInit(void)
{ {
static int docbSAXInitialized = 0; initdocbDefaultSAXHandler(&docbDefaultSAXHandler);
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 */ #endif /* LIBXML_DOCB_ENABLED */

View File

@ -78,9 +78,9 @@ if __name__ == "__main__":
writeline(global_functions_hdr,"(*(__"+fields[1]+"()))") writeline(global_functions_hdr,"(*(__"+fields[1]+"()))")
writeline(global_functions_hdr,"#else") writeline(global_functions_hdr,"#else")
if len(fields) == 3: if len(fields) == 3:
writeline(global_functions_hdr,"extern "+fields[0]+" "+fields[1]+fields[2]+";") writeline(global_functions_hdr,"LIBXML_DLL_IMPORT extern "+fields[0]+" "+fields[1]+fields[2]+";")
else: else:
writeline(global_functions_hdr,"extern "+fields[0]+" "+fields[1]+";") writeline(global_functions_hdr,"LIBXML_DLL_IMPORT extern "+fields[0]+" "+fields[1]+";")
writeline(global_functions_hdr,"#endif") writeline(global_functions_hdr,"#endif")
# Update the implementation file # Update the implementation file
writeline(global_functions_impl) writeline(global_functions_impl)
@ -96,7 +96,7 @@ if __name__ == "__main__":
writeline(global_functions_impl, " if (IS_MAIN_THREAD)") writeline(global_functions_impl, " if (IS_MAIN_THREAD)")
writeline(global_functions_impl, "\treturn (&"+fields[1]+");") writeline(global_functions_impl, "\treturn (&"+fields[1]+");")
writeline(global_functions_impl, " else") writeline(global_functions_impl, " else")
writeline(global_functions_impl, "\treturn (&get_glob_struct()->"+fields[1]+");") writeline(global_functions_impl, "\treturn (&xmlGetGlobalState()->"+fields[1]+");")
writeline(global_functions_impl, "}") writeline(global_functions_impl, "}")
# Terminate the header file with appropriate boilerplate # Terminate the header file with appropriate boilerplate
writeline(global_functions_hdr) writeline(global_functions_hdr)

11
error.c
View File

@ -69,9 +69,14 @@ xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
va_end(args); va_end(args);
} }
xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; void
void *xmlGenericErrorContext = NULL; initGenericErrorDefaultFunc(xmlGenericErrorFunc *handler)
{
if (handler == NULL)
xmlGenericError = xmlGenericErrorDefaultFunc;
else
(*handler) = xmlGenericErrorDefaultFunc;
}
/** /**
* xmlSetGenericErrorFunc: * xmlSetGenericErrorFunc:

View File

@ -7,5 +7,5 @@ INCLUDES = \
-I$(top_builddir)/include \ -I$(top_builddir)/include \
-I$(top_srcdir)/include -I@srcdir@ -I$(top_srcdir)/include -I@srcdir@
LDADD = $(top_builddir)/libxml2.la @Z_LIBS@ $(ICONV_LIBS) -lm LDADD = $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm

View File

@ -13,8 +13,7 @@
#include "libxml.h" #include "libxml.h"
#include <libxml/threads.h> #include <libxml/xmlmemory.h>
#include <libxml/globals.h>
/* /*
* Helpful Macro * Helpful Macro
@ -38,10 +37,16 @@
************************************************************************/ ************************************************************************/
const char *xmlParserVersion = LIBXML_VERSION_STRING; const char *xmlParserVersion = LIBXML_VERSION_STRING;
/* /*
* Memory allocation routines * Memory allocation routines
*/ */
#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY) #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
extern void xmlMemFree(void *ptr);
extern void * xmlMemMalloc(size_t size);
extern void * xmlMemRealloc(void *ptr,size_t size);
extern char * xmlMemoryStrdup(const char *str);
xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree; xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc; xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc; xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
@ -53,6 +58,36 @@ xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) strdup; xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) strdup;
#endif #endif
#include <libxml/threads.h>
#include <libxml/globals.h>
#include <libxml/SAX.h>
#undef docbDefaultSAXHandler
#undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility
#undef xmlBufferAllocScheme
#undef xmlDefaultBufferSize
#undef xmlDefaultSAXHandler
#undef xmlDefaultSAXLocator
#undef xmlDoValidityCheckingDefaultValue
#undef xmlGenericError
#undef xmlGenericErrorContext
#undef xmlGetWarningsDefaultValue
#undef xmlIndentTreeOutput
#undef xmlKeepBlanksDefaultValue
#undef xmlLineNumbersDefaultValue
#undef xmlLoadExtDtdDefaultValue
#undef xmlParserDebugEntities
#undef xmlParserVersion
#undef xmlPedanticParserDefaultValue
#undef xmlSaveNoEmptyTags
#undef xmlSubstituteEntitiesDefaultValue
#undef xmlFree
#undef xmlMalloc
#undef xmlMemStrdup
#undef xmlRealloc
/* /*
* Buffers stuff * Buffers stuff
*/ */
@ -62,6 +97,7 @@ int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
/* /*
* Parser defaults * Parser defaults
*/ */
int oldXMLWDcompatibility = 0; /* DEPRECATED */ int oldXMLWDcompatibility = 0; /* DEPRECATED */
int xmlParserDebugEntities = 0; int xmlParserDebugEntities = 0;
int xmlDoValidityCheckingDefaultValue = 0; int xmlDoValidityCheckingDefaultValue = 0;
@ -264,7 +300,7 @@ __docbDefaultSAXHandler(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&docbDefaultSAXHandler); return (&docbDefaultSAXHandler);
else else
return (&get_glob_struct()->docbDefaultSAXHandler); return (&xmlGetGlobalState()->docbDefaultSAXHandler);
} }
extern xmlSAXHandler htmlDefaultSAXHandler; extern xmlSAXHandler htmlDefaultSAXHandler;
@ -274,7 +310,7 @@ __htmlDefaultSAXHandler(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&htmlDefaultSAXHandler); return (&htmlDefaultSAXHandler);
else else
return (&get_glob_struct()->htmlDefaultSAXHandler); return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
} }
extern int oldXMLWDcompatibility; extern int oldXMLWDcompatibility;
@ -284,7 +320,7 @@ __oldXMLWDcompatibility(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&oldXMLWDcompatibility); return (&oldXMLWDcompatibility);
else else
return (&get_glob_struct()->oldXMLWDcompatibility); return (&xmlGetGlobalState()->oldXMLWDcompatibility);
} }
extern xmlBufferAllocationScheme xmlBufferAllocScheme; extern xmlBufferAllocationScheme xmlBufferAllocScheme;
@ -294,7 +330,7 @@ __xmlBufferAllocScheme(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlBufferAllocScheme); return (&xmlBufferAllocScheme);
else else
return (&get_glob_struct()->xmlBufferAllocScheme); return (&xmlGetGlobalState()->xmlBufferAllocScheme);
} }
extern int xmlDefaultBufferSize; extern int xmlDefaultBufferSize;
@ -304,7 +340,7 @@ __xmlDefaultBufferSize(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlDefaultBufferSize); return (&xmlDefaultBufferSize);
else else
return (&get_glob_struct()->xmlDefaultBufferSize); return (&xmlGetGlobalState()->xmlDefaultBufferSize);
} }
extern xmlSAXHandler xmlDefaultSAXHandler; extern xmlSAXHandler xmlDefaultSAXHandler;
@ -314,7 +350,7 @@ __xmlDefaultSAXHandler(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlDefaultSAXHandler); return (&xmlDefaultSAXHandler);
else else
return (&get_glob_struct()->xmlDefaultSAXHandler); return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
} }
extern xmlSAXLocator xmlDefaultSAXLocator; extern xmlSAXLocator xmlDefaultSAXLocator;
@ -324,7 +360,7 @@ __xmlDefaultSAXLocator(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlDefaultSAXLocator); return (&xmlDefaultSAXLocator);
else else
return (&get_glob_struct()->xmlDefaultSAXLocator); return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
} }
extern int xmlDoValidityCheckingDefaultValue; extern int xmlDoValidityCheckingDefaultValue;
@ -334,7 +370,7 @@ __xmlDoValidityCheckingDefaultValue(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlDoValidityCheckingDefaultValue); return (&xmlDoValidityCheckingDefaultValue);
else else
return (&get_glob_struct()->xmlDoValidityCheckingDefaultValue); return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
} }
extern xmlFreeFunc xmlFree; extern xmlFreeFunc xmlFree;
@ -344,7 +380,7 @@ __xmlFree(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlFree); return (&xmlFree);
else else
return (&get_glob_struct()->xmlFree); return (&xmlGetGlobalState()->xmlFree);
} }
extern xmlGenericErrorFunc xmlGenericError; extern xmlGenericErrorFunc xmlGenericError;
@ -354,7 +390,7 @@ __xmlGenericError(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlGenericError); return (&xmlGenericError);
else else
return (&get_glob_struct()->xmlGenericError); return (&xmlGetGlobalState()->xmlGenericError);
} }
extern void * xmlGenericErrorContext; extern void * xmlGenericErrorContext;
@ -364,7 +400,7 @@ __xmlGenericErrorContext(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlGenericErrorContext); return (&xmlGenericErrorContext);
else else
return (&get_glob_struct()->xmlGenericErrorContext); return (&xmlGetGlobalState()->xmlGenericErrorContext);
} }
extern int xmlGetWarningsDefaultValue; extern int xmlGetWarningsDefaultValue;
@ -374,7 +410,7 @@ __xmlGetWarningsDefaultValue(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlGetWarningsDefaultValue); return (&xmlGetWarningsDefaultValue);
else else
return (&get_glob_struct()->xmlGetWarningsDefaultValue); return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
} }
extern int xmlIndentTreeOutput; extern int xmlIndentTreeOutput;
@ -384,7 +420,7 @@ __xmlIndentTreeOutput(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlIndentTreeOutput); return (&xmlIndentTreeOutput);
else else
return (&get_glob_struct()->xmlIndentTreeOutput); return (&xmlGetGlobalState()->xmlIndentTreeOutput);
} }
extern int xmlKeepBlanksDefaultValue; extern int xmlKeepBlanksDefaultValue;
@ -394,7 +430,7 @@ __xmlKeepBlanksDefaultValue(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlKeepBlanksDefaultValue); return (&xmlKeepBlanksDefaultValue);
else else
return (&get_glob_struct()->xmlKeepBlanksDefaultValue); return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
} }
extern int xmlLineNumbersDefaultValue; extern int xmlLineNumbersDefaultValue;
@ -404,7 +440,7 @@ __xmlLineNumbersDefaultValue(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlLineNumbersDefaultValue); return (&xmlLineNumbersDefaultValue);
else else
return (&get_glob_struct()->xmlLineNumbersDefaultValue); return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
} }
extern int xmlLoadExtDtdDefaultValue; extern int xmlLoadExtDtdDefaultValue;
@ -414,7 +450,7 @@ __xmlLoadExtDtdDefaultValue(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlLoadExtDtdDefaultValue); return (&xmlLoadExtDtdDefaultValue);
else else
return (&get_glob_struct()->xmlLoadExtDtdDefaultValue); return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
} }
extern xmlMallocFunc xmlMalloc; extern xmlMallocFunc xmlMalloc;
@ -424,7 +460,7 @@ __xmlMalloc(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlMalloc); return (&xmlMalloc);
else else
return (&get_glob_struct()->xmlMalloc); return (&xmlGetGlobalState()->xmlMalloc);
} }
extern xmlStrdupFunc xmlMemStrdup; extern xmlStrdupFunc xmlMemStrdup;
@ -434,7 +470,7 @@ __xmlMemStrdup(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlMemStrdup); return (&xmlMemStrdup);
else else
return (&get_glob_struct()->xmlMemStrdup); return (&xmlGetGlobalState()->xmlMemStrdup);
} }
extern int xmlParserDebugEntities; extern int xmlParserDebugEntities;
@ -444,7 +480,7 @@ __xmlParserDebugEntities(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlParserDebugEntities); return (&xmlParserDebugEntities);
else else
return (&get_glob_struct()->xmlParserDebugEntities); return (&xmlGetGlobalState()->xmlParserDebugEntities);
} }
extern const char * xmlParserVersion; extern const char * xmlParserVersion;
@ -454,7 +490,7 @@ __xmlParserVersion(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlParserVersion); return (&xmlParserVersion);
else else
return (&get_glob_struct()->xmlParserVersion); return (&xmlGetGlobalState()->xmlParserVersion);
} }
extern int xmlPedanticParserDefaultValue; extern int xmlPedanticParserDefaultValue;
@ -464,7 +500,7 @@ __xmlPedanticParserDefaultValue(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlPedanticParserDefaultValue); return (&xmlPedanticParserDefaultValue);
else else
return (&get_glob_struct()->xmlPedanticParserDefaultValue); return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
} }
extern xmlReallocFunc xmlRealloc; extern xmlReallocFunc xmlRealloc;
@ -474,7 +510,7 @@ __xmlRealloc(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlRealloc); return (&xmlRealloc);
else else
return (&get_glob_struct()->xmlRealloc); return (&xmlGetGlobalState()->xmlRealloc);
} }
extern int xmlSaveNoEmptyTags; extern int xmlSaveNoEmptyTags;
@ -484,7 +520,7 @@ __xmlSaveNoEmptyTags(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlSaveNoEmptyTags); return (&xmlSaveNoEmptyTags);
else else
return (&get_glob_struct()->xmlSaveNoEmptyTags); return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
} }
extern int xmlSubstituteEntitiesDefaultValue; extern int xmlSubstituteEntitiesDefaultValue;
@ -494,5 +530,5 @@ __xmlSubstituteEntitiesDefaultValue(void) {
if (IS_MAIN_THREAD) if (IS_MAIN_THREAD)
return (&xmlSubstituteEntitiesDefaultValue); return (&xmlSubstituteEntitiesDefaultValue);
else else
return (&get_glob_struct()->xmlSubstituteEntitiesDefaultValue); return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
} }

View File

@ -111,6 +111,14 @@ void cdataBlock (void *ctx,
const xmlChar *value, const xmlChar *value,
int len); int len);
void initxmlDefaultSAXHandler (xmlSAXHandler *hdlr,
int warning);
#ifdef LIBXML_HTML_ENABLED
void inithtmlDefaultSAXHandler (xmlSAXHandler *hdlr);
#endif
#ifdef LIBXML_DOCB_ENABLED
void initdocbDefaultSAXHandler (xmlSAXHandler *hdlr);
#endif
void xmlDefaultSAXHandlerInit (void); void xmlDefaultSAXHandlerInit (void);
void htmlDefaultSAXHandlerInit (void); void htmlDefaultSAXHandlerInit (void);
void docbDefaultSAXHandlerInit (void); void docbDefaultSAXHandlerInit (void);

View File

@ -25,6 +25,7 @@ extern "C" {
* Externally global symbols which need to be protected for backwards * Externally global symbols which need to be protected for backwards
* compatibility support. * compatibility support.
*/ */
#undef docbDefaultSAXHandler #undef docbDefaultSAXHandler
#undef htmlDefaultSAXHandler #undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility #undef oldXMLWDcompatibility
@ -48,42 +49,43 @@ extern "C" {
#undef xmlPedanticParserDefaultValue #undef xmlPedanticParserDefaultValue
#undef xmlRealloc #undef xmlRealloc
#undef xmlSaveNoEmptyTags #undef xmlSaveNoEmptyTags
/* #undef xmlStringComment */
/* #undef xmlStringText */
/* #undef xmlStringTextNoenc */
#undef xmlSubstituteEntitiesDefaultValue #undef xmlSubstituteEntitiesDefaultValue
typedef struct _xmlGlobalState xmlGlobalState; typedef struct _xmlGlobalState xmlGlobalState;
typedef xmlGlobalState *xmlGlobalStatePtr; typedef xmlGlobalState *xmlGlobalStatePtr;
struct _xmlGlobalState struct _xmlGlobalState
{ {
xmlSAXHandler docbDefaultSAXHandler; const char *xmlParserVersion;
xmlSAXHandler htmlDefaultSAXHandler;
int oldXMLWDcompatibility;
xmlBufferAllocationScheme xmlBufferAllocScheme;
int xmlDefaultBufferSize;
xmlSAXHandler xmlDefaultSAXHandler;
xmlSAXLocator xmlDefaultSAXLocator;
int xmlDoValidityCheckingDefaultValue;
xmlFreeFunc xmlFree; xmlFreeFunc xmlFree;
xmlMallocFunc xmlMalloc;
xmlStrdupFunc xmlMemStrdup;
xmlReallocFunc xmlRealloc;
xmlGenericErrorFunc xmlGenericError; xmlGenericErrorFunc xmlGenericError;
void *xmlGenericErrorContext; void *xmlGenericErrorContext;
xmlSAXLocator xmlDefaultSAXLocator;
xmlSAXHandler xmlDefaultSAXHandler;
xmlSAXHandler docbDefaultSAXHandler;
xmlSAXHandler htmlDefaultSAXHandler;
int oldXMLWDcompatibility;
xmlBufferAllocationScheme xmlBufferAllocScheme;
int xmlDefaultBufferSize;
int xmlSubstituteEntitiesDefaultValue;
int xmlDoValidityCheckingDefaultValue;
int xmlGetWarningsDefaultValue; int xmlGetWarningsDefaultValue;
int xmlIndentTreeOutput;
int xmlKeepBlanksDefaultValue; int xmlKeepBlanksDefaultValue;
int xmlLineNumbersDefaultValue; int xmlLineNumbersDefaultValue;
int xmlLoadExtDtdDefaultValue; int xmlLoadExtDtdDefaultValue;
xmlMallocFunc xmlMalloc;
xmlStrdupFunc xmlMemStrdup;
int xmlParserDebugEntities; int xmlParserDebugEntities;
const char *xmlParserVersion;
int xmlPedanticParserDefaultValue; int xmlPedanticParserDefaultValue;
xmlReallocFunc xmlRealloc;
int xmlSaveNoEmptyTags; int xmlSaveNoEmptyTags;
/* const xmlChar xmlStringComment[8]; */ int xmlIndentTreeOutput;
/* const xmlChar xmlStringText[5]; */
/* const xmlChar xmlStringTextNoenc[10]; */
int xmlSubstituteEntitiesDefaultValue;
}; };
void xmlInitializeGlobalState(xmlGlobalStatePtr gs); void xmlInitializeGlobalState(xmlGlobalStatePtr gs);
@ -100,7 +102,7 @@ extern xmlSAXHandler *__docbDefaultSAXHandler(void);
#define docbDefaultSAXHandler \ #define docbDefaultSAXHandler \
(*(__docbDefaultSAXHandler())) (*(__docbDefaultSAXHandler()))
#else #else
extern xmlSAXHandler docbDefaultSAXHandler; LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -108,7 +110,7 @@ extern xmlSAXHandler *__htmlDefaultSAXHandler(void);
#define htmlDefaultSAXHandler \ #define htmlDefaultSAXHandler \
(*(__htmlDefaultSAXHandler())) (*(__htmlDefaultSAXHandler()))
#else #else
extern xmlSAXHandler htmlDefaultSAXHandler; LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -116,7 +118,7 @@ extern int *__oldXMLWDcompatibility(void);
#define oldXMLWDcompatibility \ #define oldXMLWDcompatibility \
(*(__oldXMLWDcompatibility())) (*(__oldXMLWDcompatibility()))
#else #else
extern int oldXMLWDcompatibility; LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -124,7 +126,7 @@ extern xmlBufferAllocationScheme *__xmlBufferAllocScheme(void);
#define xmlBufferAllocScheme \ #define xmlBufferAllocScheme \
(*(__xmlBufferAllocScheme())) (*(__xmlBufferAllocScheme()))
#else #else
extern xmlBufferAllocationScheme xmlBufferAllocScheme; LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -132,7 +134,7 @@ extern int *__xmlDefaultBufferSize(void);
#define xmlDefaultBufferSize \ #define xmlDefaultBufferSize \
(*(__xmlDefaultBufferSize())) (*(__xmlDefaultBufferSize()))
#else #else
extern int xmlDefaultBufferSize; LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -140,7 +142,7 @@ extern xmlSAXHandler *__xmlDefaultSAXHandler(void);
#define xmlDefaultSAXHandler \ #define xmlDefaultSAXHandler \
(*(__xmlDefaultSAXHandler())) (*(__xmlDefaultSAXHandler()))
#else #else
extern xmlSAXHandler xmlDefaultSAXHandler; LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -148,7 +150,7 @@ extern xmlSAXLocator *__xmlDefaultSAXLocator(void);
#define xmlDefaultSAXLocator \ #define xmlDefaultSAXLocator \
(*(__xmlDefaultSAXLocator())) (*(__xmlDefaultSAXLocator()))
#else #else
extern xmlSAXLocator xmlDefaultSAXLocator; LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -156,7 +158,7 @@ extern int *__xmlDoValidityCheckingDefaultValue(void);
#define xmlDoValidityCheckingDefaultValue \ #define xmlDoValidityCheckingDefaultValue \
(*(__xmlDoValidityCheckingDefaultValue())) (*(__xmlDoValidityCheckingDefaultValue()))
#else #else
extern int xmlDoValidityCheckingDefaultValue; LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -164,7 +166,7 @@ extern xmlFreeFunc *__xmlFree(void);
#define xmlFree \ #define xmlFree \
(*(__xmlFree())) (*(__xmlFree()))
#else #else
extern xmlFreeFunc xmlFree; LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -172,7 +174,7 @@ extern xmlGenericErrorFunc *__xmlGenericError(void);
#define xmlGenericError \ #define xmlGenericError \
(*(__xmlGenericError())) (*(__xmlGenericError()))
#else #else
extern xmlGenericErrorFunc xmlGenericError; LIBXML_DLL_IMPORT extern xmlGenericErrorFunc xmlGenericError;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -180,7 +182,7 @@ extern void * *__xmlGenericErrorContext(void);
#define xmlGenericErrorContext \ #define xmlGenericErrorContext \
(*(__xmlGenericErrorContext())) (*(__xmlGenericErrorContext()))
#else #else
extern void * xmlGenericErrorContext; LIBXML_DLL_IMPORT extern void * xmlGenericErrorContext;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -188,7 +190,7 @@ extern int *__xmlGetWarningsDefaultValue(void);
#define xmlGetWarningsDefaultValue \ #define xmlGetWarningsDefaultValue \
(*(__xmlGetWarningsDefaultValue())) (*(__xmlGetWarningsDefaultValue()))
#else #else
extern int xmlGetWarningsDefaultValue; LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -196,7 +198,7 @@ extern int *__xmlIndentTreeOutput(void);
#define xmlIndentTreeOutput \ #define xmlIndentTreeOutput \
(*(__xmlIndentTreeOutput())) (*(__xmlIndentTreeOutput()))
#else #else
extern int xmlIndentTreeOutput; LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -204,7 +206,7 @@ extern int *__xmlKeepBlanksDefaultValue(void);
#define xmlKeepBlanksDefaultValue \ #define xmlKeepBlanksDefaultValue \
(*(__xmlKeepBlanksDefaultValue())) (*(__xmlKeepBlanksDefaultValue()))
#else #else
extern int xmlKeepBlanksDefaultValue; LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -212,7 +214,7 @@ extern int *__xmlLineNumbersDefaultValue(void);
#define xmlLineNumbersDefaultValue \ #define xmlLineNumbersDefaultValue \
(*(__xmlLineNumbersDefaultValue())) (*(__xmlLineNumbersDefaultValue()))
#else #else
extern int xmlLineNumbersDefaultValue; LIBXML_DLL_IMPORT extern int xmlLineNumbersDefaultValue;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -220,7 +222,7 @@ extern int *__xmlLoadExtDtdDefaultValue(void);
#define xmlLoadExtDtdDefaultValue \ #define xmlLoadExtDtdDefaultValue \
(*(__xmlLoadExtDtdDefaultValue())) (*(__xmlLoadExtDtdDefaultValue()))
#else #else
extern int xmlLoadExtDtdDefaultValue; LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -228,7 +230,7 @@ extern xmlMallocFunc *__xmlMalloc(void);
#define xmlMalloc \ #define xmlMalloc \
(*(__xmlMalloc())) (*(__xmlMalloc()))
#else #else
extern xmlMallocFunc xmlMalloc; LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -236,7 +238,7 @@ extern xmlStrdupFunc *__xmlMemStrdup(void);
#define xmlMemStrdup \ #define xmlMemStrdup \
(*(__xmlMemStrdup())) (*(__xmlMemStrdup()))
#else #else
extern xmlStrdupFunc xmlMemStrdup; LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -244,7 +246,7 @@ extern int *__xmlParserDebugEntities(void);
#define xmlParserDebugEntities \ #define xmlParserDebugEntities \
(*(__xmlParserDebugEntities())) (*(__xmlParserDebugEntities()))
#else #else
extern int xmlParserDebugEntities; LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -252,7 +254,7 @@ extern const char * *__xmlParserVersion(void);
#define xmlParserVersion \ #define xmlParserVersion \
(*(__xmlParserVersion())) (*(__xmlParserVersion()))
#else #else
extern const char * xmlParserVersion; LIBXML_DLL_IMPORT extern const char * xmlParserVersion;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -260,7 +262,7 @@ extern int *__xmlPedanticParserDefaultValue(void);
#define xmlPedanticParserDefaultValue \ #define xmlPedanticParserDefaultValue \
(*(__xmlPedanticParserDefaultValue())) (*(__xmlPedanticParserDefaultValue()))
#else #else
extern int xmlPedanticParserDefaultValue; LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -268,7 +270,7 @@ extern xmlReallocFunc *__xmlRealloc(void);
#define xmlRealloc \ #define xmlRealloc \
(*(__xmlRealloc())) (*(__xmlRealloc()))
#else #else
extern xmlReallocFunc xmlRealloc; LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -276,7 +278,7 @@ extern int *__xmlSaveNoEmptyTags(void);
#define xmlSaveNoEmptyTags \ #define xmlSaveNoEmptyTags \
(*(__xmlSaveNoEmptyTags())) (*(__xmlSaveNoEmptyTags()))
#else #else
extern int xmlSaveNoEmptyTags; LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags;
#endif #endif
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
@ -284,7 +286,7 @@ extern int *__xmlSubstituteEntitiesDefaultValue(void);
#define xmlSubstituteEntitiesDefaultValue \ #define xmlSubstituteEntitiesDefaultValue \
(*(__xmlSubstituteEntitiesDefaultValue())) (*(__xmlSubstituteEntitiesDefaultValue()))
#else #else
extern int xmlSubstituteEntitiesDefaultValue; LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -13,7 +13,9 @@
#include <libxml/valid.h> #include <libxml/valid.h>
#include <libxml/xmlIO.h> #include <libxml/xmlIO.h>
#include <libxml/entities.h> #include <libxml/entities.h>
#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
#include <pthread.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -319,6 +321,7 @@ struct _xmlSAXHandler {
getParameterEntitySAXFunc getParameterEntity; getParameterEntitySAXFunc getParameterEntity;
cdataBlockSAXFunc cdataBlock; cdataBlockSAXFunc cdataBlock;
externalSubsetSAXFunc externalSubset; externalSubsetSAXFunc externalSubset;
int initialized;
}; };
/** /**
@ -571,6 +574,12 @@ xmlParserInputPtr
xmlLoadExternalEntity (const char *URL, xmlLoadExternalEntity (const char *URL,
const char *ID, const char *ID,
xmlParserCtxtPtr context); xmlParserCtxtPtr context);
#include <libxml/globals.h>
/*
* Parser Locking
*/
int xmlLockContext(xmlParserCtxtPtr ctxt);
int xmlUnlockContext(xmlParserCtxtPtr ctxt);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -173,19 +173,6 @@ extern "C" {
#define MOVETO_STARTTAG(p) \ #define MOVETO_STARTTAG(p) \
while ((*p) && (*(p) != '<')) (p)++ while ((*p) && (*(p) != '<')) (p)++
/**
* Global vaiables affecting the default parser behaviour.
*/
LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
/** /**
* Global variables used for predefined strings * Global variables used for predefined strings
*/ */

View File

@ -25,6 +25,8 @@
extern "C" { extern "C" {
#endif #endif
#define BASE_BUFFER_SIZE 4000
/** /**
* XML_XML_NAMESPACE: * XML_XML_NAMESPACE:
* *

View File

@ -2,6 +2,7 @@
#define __XML_ERROR_H__ #define __XML_ERROR_H__
#include <libxml/parser.h> #include <libxml/parser.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -144,18 +145,12 @@ typedef enum {
typedef void (*xmlGenericErrorFunc) (void *ctx, const char *msg, ...); typedef void (*xmlGenericErrorFunc) (void *ctx, const char *msg, ...);
/* /*
* Those are the default error function and associated context to use * Use the following function to reset the two global variables
* when when there is an error and no parsing or validity context available * xmlGenericError and xmlGenericErrorContext.
*/
LIBXML_DLL_IMPORT extern xmlGenericErrorFunc xmlGenericError;
LIBXML_DLL_IMPORT extern void *xmlGenericErrorContext;
/*
* Use the following function to reset the two previous global variables.
*/ */
void xmlSetGenericErrorFunc (void *ctx, void xmlSetGenericErrorFunc (void *ctx,
xmlGenericErrorFunc handler); xmlGenericErrorFunc handler);
void initGenericErrorDefaultFunc(xmlGenericErrorFunc *handler);
/* /*
* Default message routines used by SAX and Valid context for error * Default message routines used by SAX and Valid context for error

View File

@ -56,8 +56,9 @@
#endif #endif
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/nanoftp.h> #include <libxml/parser.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/nanoftp.h>
/* #define DEBUG_FTP 1 */ /* #define DEBUG_FTP 1 */
#ifdef STANDALONE #ifdef STANDALONE

View File

@ -63,6 +63,7 @@
#define SOCKET int #define SOCKET int
#endif #endif
#include <libxml/globals.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/parser.h> /* for xmlStr(n)casecmp() */ #include <libxml/parser.h> /* for xmlStr(n)casecmp() */

View File

@ -41,6 +41,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/threads.h>
#include <libxml/globals.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/parserInternals.h> #include <libxml/parserInternals.h>
@ -77,11 +79,6 @@
#define XML_PARSER_BIG_BUFFER_SIZE 300 #define XML_PARSER_BIG_BUFFER_SIZE 300
#define XML_PARSER_BUFFER_SIZE 100 #define XML_PARSER_BUFFER_SIZE 100
/*
* Various global defaults for parsing
*/
int xmlParserDebugEntities = 0;
/* /*
* List of XML prefixed PI allowed by W3C specs * List of XML prefixed PI allowed by W3C specs
*/ */
@ -10191,6 +10188,8 @@ void
xmlInitParser(void) { xmlInitParser(void) {
if (xmlParserInitialized) return; if (xmlParserInitialized) return;
xmlInitThreads();
initGenericErrorDefaultFunc(NULL);
xmlInitCharEncodingHandlers(); xmlInitCharEncodingHandlers();
xmlInitializePredefinedEntities(); xmlInitializePredefinedEntities();
xmlDefaultSAXHandlerInit(); xmlDefaultSAXHandlerInit();
@ -10217,11 +10216,11 @@ xmlInitParser(void) {
void void
xmlCleanupParser(void) { xmlCleanupParser(void) {
xmlParserInitialized = 0;
xmlCleanupCharEncodingHandlers(); xmlCleanupCharEncodingHandlers();
xmlCleanupPredefinedEntities(); xmlCleanupPredefinedEntities();
#ifdef LIBXML_CATALOG_ENABLED #ifdef LIBXML_CATALOG_ENABLED
xmlCatalogCleanup(); xmlCatalogCleanup();
#endif #endif
xmlCleanupThreads();
xmlParserInitialized = 0;
} }

View File

@ -56,27 +56,12 @@ void xmlUpgradeOldNs(xmlDocPtr doc);
/* /*
* Various global defaults for parsing * Various global defaults for parsing
*/ */
int xmlGetWarningsDefaultValue = 1;
#ifdef VMS #ifdef VMS
int xmlSubstituteEntitiesDefaultVal = 0; int xmlSubstituteEntitiesDefaultVal = 0;
#define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal #define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal
int xmlDoValidityCheckingDefaultVal = 0; int xmlDoValidityCheckingDefaultVal = 0;
#define xmlDoValidityCheckingDefaultValue xmlDoValidityCheckingDefaultVal #define xmlDoValidityCheckingDefaultValue xmlDoValidityCheckingDefaultVal
#else
int xmlSubstituteEntitiesDefaultValue = 0;
int xmlDoValidityCheckingDefaultValue = 0;
#endif #endif
int xmlLoadExtDtdDefaultValue = 0;
int xmlPedanticParserDefaultValue = 0;
int xmlLineNumbersDefaultValue = 0;
int xmlKeepBlanksDefaultValue = 1;
/************************************************************************
* *
* Version and Features handling *
* *
************************************************************************/
const char *xmlParserVersion = LIBXML_VERSION_STRING;
/** /**
* xmlCheckVersion: * xmlCheckVersion:

View File

@ -74,7 +74,8 @@ xmlSAXHandler emptySAXHandlerStruct = {
NULL, /* xmlParserError */ NULL, /* xmlParserError */
NULL, /* getParameterEntity */ NULL, /* getParameterEntity */
NULL, /* cdataBlock */ NULL, /* cdataBlock */
NULL /* externalSubset */ NULL, /* externalSubset */
1
}; };
xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct; xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
@ -609,7 +610,8 @@ xmlSAXHandler debugSAXHandlerStruct = {
fatalErrorDebug, fatalErrorDebug,
getParameterEntityDebug, getParameterEntityDebug,
cdataBlockDebug, cdataBlockDebug,
externalSubsetDebug externalSubsetDebug,
1
}; };
xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct; xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct;

View File

@ -73,7 +73,8 @@ xmlSAXHandler emptySAXHandlerStruct = {
NULL, /* xmlParserError */ NULL, /* xmlParserError */
NULL, /* getParameterEntity */ NULL, /* getParameterEntity */
NULL, /* cdataBlock */ NULL, /* cdataBlock */
NULL /* externalSubset */ NULL, /* externalSubset */
1
}; };
xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct; xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
@ -591,7 +592,8 @@ xmlSAXHandler debugSAXHandlerStruct = {
fatalErrorDebug, fatalErrorDebug,
getParameterEntityDebug, getParameterEntityDebug,
cdataDebug, cdataDebug,
NULL NULL,
1
}; };
xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct; xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct;

View File

@ -31,6 +31,7 @@
#endif #endif
#include <libxml/globals.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/parserInternals.h> /* only for xmlNewInputFromFile() */ #include <libxml/parserInternals.h> /* only for xmlNewInputFromFile() */
@ -71,7 +72,8 @@ xmlSAXHandler emptySAXHandlerStruct = {
NULL, /* xmlParserError */ NULL, /* xmlParserError */
NULL, /* getParameterEntity */ NULL, /* getParameterEntity */
NULL, /* cdataBlock; */ NULL, /* cdataBlock; */
NULL /* externalSubset; */ NULL, /* externalSubset; */
1
}; };
xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct; xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
@ -597,7 +599,8 @@ xmlSAXHandler debugSAXHandlerStruct = {
fatalErrorDebug, fatalErrorDebug,
getParameterEntityDebug, getParameterEntityDebug,
cdataBlockDebug, cdataBlockDebug,
externalSubsetDebug externalSubsetDebug,
1
}; };
xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct; xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct;

19
tree.c
View File

@ -36,30 +36,21 @@
xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns); xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
/************************************************************************
* *
* Deprecated *
* *
************************************************************************/
int oldXMLWDcompatibility = 0;
/************************************************************************ /************************************************************************
* * * *
* A few static variables and macros * * A few static variables and macros *
* * * *
************************************************************************/ ************************************************************************/
/* #undef xmlStringText */
const xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 }; const xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
/* #undef xmlStringTextNoenc */
const xmlChar xmlStringTextNoenc[] = const xmlChar xmlStringTextNoenc[] =
{ 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 }; { 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 };
/* #undef xmlStringComment */
const xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 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 xmlCompressMode = 0;
static int xmlCheckDTD = 1; static int xmlCheckDTD = 1;
int xmlSaveNoEmptyTags = 0;
#define UPDATE_LAST_CHILD_AND_PARENT(n) if ((n) != NULL) { \ #define UPDATE_LAST_CHILD_AND_PARENT(n) if ((n) != NULL) { \
xmlNodePtr ulccur = (n)->children; \ xmlNodePtr ulccur = (n)->children; \
@ -4744,10 +4735,6 @@ xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) {
* * * *
************************************************************************/ ************************************************************************/
#define BASE_BUFFER_SIZE 4000
int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
/** /**
* xmlBufferCreate: * xmlBufferCreate:
* *

1
uri.c
View File

@ -14,6 +14,7 @@
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/uri.h> #include <libxml/uri.h>
#include <libxml/globals.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
/************************************************************************ /************************************************************************

View File

@ -45,8 +45,8 @@
* * * *
****************************************************************/ ****************************************************************/
xlinkHandlerPtr xlinkDefaultHandler = NULL; static xlinkHandlerPtr xlinkDefaultHandler = NULL;
xlinkNodeDetectFunc xlinkDefaultDetect = NULL; static xlinkNodeDetectFunc xlinkDefaultDetect = NULL;
/** /**
* xlinkGetDefaultHandler: * xlinkGetDefaultHandler:

View File

@ -26,6 +26,7 @@
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/globals.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
void xmlMallocBreakpoint(void); void xmlMallocBreakpoint(void);
@ -657,18 +658,6 @@ xmlMemoryDump(void)
* * * *
****************************************************************/ ****************************************************************/
#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: * xmlInitMemory:
* *