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>
* Makefile.am include/libxml/Makefile.am

View File

@ -3557,6 +3557,8 @@ static int
htmlParseDocument(htmlParserCtxtPtr ctxt) {
xmlDtdPtr dtd;
xmlInitParser();
htmlDefaultSAXHandlerInit();
ctxt->html = 1;
@ -4669,6 +4671,8 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
htmlParserInputPtr inputStream;
xmlParserInputBufferPtr buf;
xmlInitParser();
buf = xmlAllocParserInputBuffer(enc);
if (buf == NULL) return(NULL);
@ -4745,6 +4749,8 @@ htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void
htmlDocPtr ret;
htmlParserCtxtPtr ctxt;
xmlInitParser();
if (cur == NULL) return(NULL);
@ -4869,6 +4875,8 @@ htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr s
htmlParserCtxtPtr ctxt;
htmlSAXHandlerPtr oldsax = NULL;
xmlInitParser();
ctxt = htmlCreateFileParserCtxt(filename, encoding);
if (ctxt == NULL) return(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 \
valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.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
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 threads.c
catalog.c globals.c threads.c
endif

330
SAX.c
View File

@ -88,14 +88,6 @@ getColumnNumber(void *ctx)
return(ctxt->input->col);
}
/*
* The default SAX Locator.
*/
xmlSAXLocator xmlDefaultSAXLocator = {
getPublicId, getSystemId, getLineNumber, getColumnNumber
};
/**
* isStandalone:
* @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 = {
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,
};
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:
@ -1708,77 +1713,52 @@ xmlSAXHandler xmlDefaultSAXHandler = {
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;
initxmlDefaultSAXHandler(&xmlDefaultSAXHandler, xmlGetWarningsDefaultValue);
}
#ifdef LIBXML_HTML_ENABLED
/*
* Default handler for HTML, builds the DOM tree
/**
* htmlDefaultSAXHandlerInit:
*
* Initialize the default SAX handler
*/
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,
};
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:
@ -1788,75 +1768,49 @@ xmlSAXHandler htmlDefaultSAXHandler = {
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;
inithtmlDefaultSAXHandler(&htmlDefaultSAXHandler);
}
#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,
};
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,39 +1820,7 @@ xmlSAXHandler docbDefaultSAXHandler = {
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;
initdocbDefaultSAXHandler(&docbDefaultSAXHandler);
}
#endif /* LIBXML_DOCB_ENABLED */

View File

@ -78,9 +78,9 @@ if __name__ == "__main__":
writeline(global_functions_hdr,"(*(__"+fields[1]+"()))")
writeline(global_functions_hdr,"#else")
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:
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")
# Update the implementation file
writeline(global_functions_impl)
@ -96,7 +96,7 @@ if __name__ == "__main__":
writeline(global_functions_impl, " if (IS_MAIN_THREAD)")
writeline(global_functions_impl, "\treturn (&"+fields[1]+");")
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, "}")
# Terminate the header file with appropriate boilerplate
writeline(global_functions_hdr)

11
error.c
View File

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

View File

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

View File

@ -111,6 +111,14 @@ void cdataBlock (void *ctx,
const xmlChar *value,
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 htmlDefaultSAXHandlerInit (void);
void docbDefaultSAXHandlerInit (void);

View File

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

View File

@ -13,7 +13,9 @@
#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" {
@ -319,6 +321,7 @@ struct _xmlSAXHandler {
getParameterEntitySAXFunc getParameterEntity;
cdataBlockSAXFunc cdataBlock;
externalSubsetSAXFunc externalSubset;
int initialized;
};
/**
@ -571,6 +574,12 @@ xmlParserInputPtr
xmlLoadExternalEntity (const char *URL,
const char *ID,
xmlParserCtxtPtr context);
#include <libxml/globals.h>
/*
* Parser Locking
*/
int xmlLockContext(xmlParserCtxtPtr ctxt);
int xmlUnlockContext(xmlParserCtxtPtr ctxt);
#ifdef __cplusplus
}

View File

@ -173,19 +173,6 @@ extern "C" {
#define MOVETO_STARTTAG(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
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -56,27 +56,12 @@ void xmlUpgradeOldNs(xmlDocPtr doc);
/*
* 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:

View File

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

View File

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

View File

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

19
tree.c
View File

@ -36,30 +36,21 @@
xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
/************************************************************************
* *
* Deprecated *
* *
************************************************************************/
int oldXMLWDcompatibility = 0;
/************************************************************************
* *
* 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 };
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; \
@ -4744,10 +4735,6 @@ xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) {
* *
************************************************************************/
#define BASE_BUFFER_SIZE 4000
int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
/**
* xmlBufferCreate:
*

1
uri.c
View File

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

View File

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

View File

@ -26,6 +26,7 @@
#include <libxml/xmlmemory.h>
#include <libxml/globals.h>
#include <libxml/xmlerror.h>
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:
*