12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127 |
- /*
- * globals.c: definition and handling of the set of global variables
- * of the library
- *
- * The bottom of this file is automatically generated by build_glob.py
- * based on the description file global.data
- *
- * See Copyright for the status of this software.
- *
- * Gary Pennington <Gary.Pennington@uk.sun.com>
- * daniel@veillard.com
- */
- #define IN_LIBXML
- #include "libxml.h"
- #ifdef HAVE_STDLIB_H
- #include <stdlib.h>
- #endif
- #include <string.h>
- #include <libxml/globals.h>
- #include <libxml/xmlmemory.h>
- #include <libxml/threads.h>
- /* #define DEBUG_GLOBALS */
- /*
- * Helpful Macro
- */
- #ifdef LIBXML_THREAD_ENABLED
- #define IS_MAIN_THREAD (xmlIsMainThread())
- #else
- #define IS_MAIN_THREAD 1
- #endif
- /*
- * Mutex to protect "ForNewThreads" variables
- */
- static xmlMutexPtr xmlThrDefMutex = NULL;
- /**
- * xmlInitGlobals:
- *
- * Additional initialisation for multi-threading
- */
- void xmlInitGlobals(void)
- {
- if (xmlThrDefMutex == NULL)
- xmlThrDefMutex = xmlNewMutex();
- }
- /**
- * xmlCleanupGlobals:
- *
- * Additional cleanup for multi-threading
- */
- void xmlCleanupGlobals(void)
- {
- if (xmlThrDefMutex != NULL) {
- xmlFreeMutex(xmlThrDefMutex);
- xmlThrDefMutex = NULL;
- }
- __xmlGlobalInitMutexDestroy();
- }
- /************************************************************************
- * *
- * All the user accessible global variables of the library *
- * *
- ************************************************************************/
- /*
- * Memory allocation routines
- */
- #undef xmlFree
- #undef xmlMalloc
- #undef xmlMallocAtomic
- #undef xmlMemStrdup
- #undef xmlRealloc
- #if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
- xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
- xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
- xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
- xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
- xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
- #else
- /**
- * xmlFree:
- * @mem: an already allocated block of memory
- *
- * The variable holding the libxml free() implementation
- */
- xmlFreeFunc xmlFree = free;
- /**
- * xmlMalloc:
- * @size: the size requested in bytes
- *
- * The variable holding the libxml malloc() implementation
- *
- * Returns a pointer to the newly allocated block or NULL in case of error
- */
- xmlMallocFunc xmlMalloc = malloc;
- /**
- * xmlMallocAtomic:
- * @size: the size requested in bytes
- *
- * The variable holding the libxml malloc() implementation for atomic
- * data (i.e. blocks not containing pointers), useful when using a
- * garbage collecting allocator.
- *
- * Returns a pointer to the newly allocated block or NULL in case of error
- */
- xmlMallocFunc xmlMallocAtomic = malloc;
- /**
- * xmlRealloc:
- * @mem: an already allocated block of memory
- * @size: the new size requested in bytes
- *
- * The variable holding the libxml realloc() implementation
- *
- * Returns a pointer to the newly reallocated block or NULL in case of error
- */
- xmlReallocFunc xmlRealloc = realloc;
- /**
- * xmlPosixStrdup
- * @cur: the input char *
- *
- * a strdup implementation with a type signature matching POSIX
- *
- * Returns a new xmlChar * or NULL
- */
- static char *
- xmlPosixStrdup(const char *cur) {
- return((char*) xmlCharStrdup(cur));
- }
- /**
- * xmlMemStrdup:
- * @str: a zero terminated string
- *
- * The variable holding the libxml strdup() implementation
- *
- * Returns the copy of the string or NULL in case of error
- */
- xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup;
- #endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
- #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 xmlStructuredError
- #undef xmlGenericErrorContext
- #undef xmlStructuredErrorContext
- #undef xmlGetWarningsDefaultValue
- #undef xmlIndentTreeOutput
- #undef xmlTreeIndentString
- #undef xmlKeepBlanksDefaultValue
- #undef xmlLineNumbersDefaultValue
- #undef xmlLoadExtDtdDefaultValue
- #undef xmlParserDebugEntities
- #undef xmlParserVersion
- #undef xmlPedanticParserDefaultValue
- #undef xmlSaveNoEmptyTags
- #undef xmlSubstituteEntitiesDefaultValue
- #undef xmlRegisterNodeDefaultValue
- #undef xmlDeregisterNodeDefaultValue
- #undef xmlLastError
- #undef xmlParserInputBufferCreateFilenameValue
- #undef xmlOutputBufferCreateFilenameValue
- /**
- * xmlParserVersion:
- *
- * Constant string describing the internal version of the library
- */
- const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
- /**
- * xmlBufferAllocScheme:
- *
- * Global setting, default allocation policy for buffers, default is
- * XML_BUFFER_ALLOC_EXACT
- */
- xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
- static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
- /**
- * xmlDefaultBufferSize:
- *
- * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
- */
- int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
- static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
- /*
- * Parser defaults
- */
- /**
- * oldXMLWDcompatibility:
- *
- * Global setting, DEPRECATED.
- */
- int oldXMLWDcompatibility = 0; /* DEPRECATED */
- /**
- * xmlParserDebugEntities:
- *
- * Global setting, asking the parser to print out debugging information.
- * while handling entities.
- * Disabled by default
- */
- int xmlParserDebugEntities = 0;
- static int xmlParserDebugEntitiesThrDef = 0;
- /**
- * xmlDoValidityCheckingDefaultValue:
- *
- * Global setting, indicate that the parser should work in validating mode.
- * Disabled by default.
- */
- int xmlDoValidityCheckingDefaultValue = 0;
- static int xmlDoValidityCheckingDefaultValueThrDef = 0;
- /**
- * xmlGetWarningsDefaultValue:
- *
- * Global setting, indicate that the parser should provide warnings.
- * Activated by default.
- */
- int xmlGetWarningsDefaultValue = 1;
- static int xmlGetWarningsDefaultValueThrDef = 1;
- /**
- * xmlLoadExtDtdDefaultValue:
- *
- * Global setting, indicate that the parser should load DTD while not
- * validating.
- * Disabled by default.
- */
- int xmlLoadExtDtdDefaultValue = 0;
- static int xmlLoadExtDtdDefaultValueThrDef = 0;
- /**
- * xmlPedanticParserDefaultValue:
- *
- * Global setting, indicate that the parser be pedantic
- * Disabled by default.
- */
- int xmlPedanticParserDefaultValue = 0;
- static int xmlPedanticParserDefaultValueThrDef = 0;
- /**
- * xmlLineNumbersDefaultValue:
- *
- * Global setting, indicate that the parser should store the line number
- * in the content field of elements in the DOM tree.
- * Disabled by default since this may not be safe for old classes of
- * application.
- */
- int xmlLineNumbersDefaultValue = 0;
- static int xmlLineNumbersDefaultValueThrDef = 0;
- /**
- * xmlKeepBlanksDefaultValue:
- *
- * Global setting, indicate that the parser should keep all blanks
- * nodes found in the content
- * Activated by default, this is actually needed to have the parser
- * conformant to the XML Recommendation, however the option is kept
- * for some applications since this was libxml1 default behaviour.
- */
- int xmlKeepBlanksDefaultValue = 1;
- static int xmlKeepBlanksDefaultValueThrDef = 1;
- /**
- * xmlSubstituteEntitiesDefaultValue:
- *
- * Global setting, indicate that the parser should not generate entity
- * references but replace them with the actual content of the entity
- * Disabled by default, this should be activated when using XPath since
- * the XPath data model requires entities replacement and the XPath
- * engine does not handle entities references transparently.
- */
- int xmlSubstituteEntitiesDefaultValue = 0;
- static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
- xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
- static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
- xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
- static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
- xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
- static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
- xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
- static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
- /*
- * Error handling
- */
- /* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
- /* Must initialize xmlGenericError in xmlInitParser */
- void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
- const char *msg,
- ...);
- /**
- * xmlGenericError:
- *
- * Global setting: function used for generic error callbacks
- */
- xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
- static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
- /**
- * xmlStructuredError:
- *
- * Global setting: function used for structured error callbacks
- */
- xmlStructuredErrorFunc xmlStructuredError = NULL;
- static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
- /**
- * xmlGenericErrorContext:
- *
- * Global setting passed to generic error callbacks
- */
- void *xmlGenericErrorContext = NULL;
- static void *xmlGenericErrorContextThrDef = NULL;
- /**
- * xmlStructuredErrorContext:
- *
- * Global setting passed to structured error callbacks
- */
- void *xmlStructuredErrorContext = NULL;
- static void *xmlStructuredErrorContextThrDef = NULL;
- xmlError xmlLastError;
- /*
- * output defaults
- */
- /**
- * xmlIndentTreeOutput:
- *
- * Global setting, asking the serializer to indent the output tree by default
- * Enabled by default
- */
- int xmlIndentTreeOutput = 1;
- static int xmlIndentTreeOutputThrDef = 1;
- /**
- * xmlTreeIndentString:
- *
- * The string used to do one-level indent. By default is equal to " " (two spaces)
- */
- const char *xmlTreeIndentString = " ";
- static const char *xmlTreeIndentStringThrDef = " ";
- /**
- * xmlSaveNoEmptyTags:
- *
- * Global setting, asking the serializer to not output empty tags
- * as <empty/> but <empty></empty>. those two forms are indistinguishable
- * once parsed.
- * Disabled by default
- */
- int xmlSaveNoEmptyTags = 0;
- static int xmlSaveNoEmptyTagsThrDef = 0;
- #ifdef LIBXML_SAX1_ENABLED
- /**
- * xmlDefaultSAXHandler:
- *
- * Default SAX version1 handler for XML, builds the DOM tree
- */
- xmlSAXHandlerV1 xmlDefaultSAXHandler = {
- xmlSAX2InternalSubset,
- xmlSAX2IsStandalone,
- xmlSAX2HasInternalSubset,
- xmlSAX2HasExternalSubset,
- xmlSAX2ResolveEntity,
- xmlSAX2GetEntity,
- xmlSAX2EntityDecl,
- xmlSAX2NotationDecl,
- xmlSAX2AttributeDecl,
- xmlSAX2ElementDecl,
- xmlSAX2UnparsedEntityDecl,
- xmlSAX2SetDocumentLocator,
- xmlSAX2StartDocument,
- xmlSAX2EndDocument,
- xmlSAX2StartElement,
- xmlSAX2EndElement,
- xmlSAX2Reference,
- xmlSAX2Characters,
- xmlSAX2Characters,
- xmlSAX2ProcessingInstruction,
- xmlSAX2Comment,
- xmlParserWarning,
- xmlParserError,
- xmlParserError,
- xmlSAX2GetParameterEntity,
- xmlSAX2CDataBlock,
- xmlSAX2ExternalSubset,
- 0,
- };
- #endif /* LIBXML_SAX1_ENABLED */
- /**
- * xmlDefaultSAXLocator:
- *
- * The default SAX Locator
- * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
- */
- xmlSAXLocator xmlDefaultSAXLocator = {
- xmlSAX2GetPublicId,
- xmlSAX2GetSystemId,
- xmlSAX2GetLineNumber,
- xmlSAX2GetColumnNumber
- };
- #ifdef LIBXML_HTML_ENABLED
- /**
- * htmlDefaultSAXHandler:
- *
- * Default old SAX v1 handler for HTML, builds the DOM tree
- */
- xmlSAXHandlerV1 htmlDefaultSAXHandler = {
- xmlSAX2InternalSubset,
- NULL,
- NULL,
- NULL,
- NULL,
- xmlSAX2GetEntity,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- xmlSAX2SetDocumentLocator,
- xmlSAX2StartDocument,
- xmlSAX2EndDocument,
- xmlSAX2StartElement,
- xmlSAX2EndElement,
- NULL,
- xmlSAX2Characters,
- xmlSAX2IgnorableWhitespace,
- xmlSAX2ProcessingInstruction,
- xmlSAX2Comment,
- xmlParserWarning,
- xmlParserError,
- xmlParserError,
- xmlSAX2GetParameterEntity,
- xmlSAX2CDataBlock,
- NULL,
- 0,
- };
- #endif /* LIBXML_HTML_ENABLED */
- #ifdef LIBXML_DOCB_ENABLED
- /**
- * docbDefaultSAXHandler:
- *
- * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
- */
- xmlSAXHandlerV1 docbDefaultSAXHandler = {
- xmlSAX2InternalSubset,
- xmlSAX2IsStandalone,
- xmlSAX2HasInternalSubset,
- xmlSAX2HasExternalSubset,
- xmlSAX2ResolveEntity,
- xmlSAX2GetEntity,
- xmlSAX2EntityDecl,
- NULL,
- NULL,
- NULL,
- NULL,
- xmlSAX2SetDocumentLocator,
- xmlSAX2StartDocument,
- xmlSAX2EndDocument,
- xmlSAX2StartElement,
- xmlSAX2EndElement,
- xmlSAX2Reference,
- xmlSAX2Characters,
- xmlSAX2IgnorableWhitespace,
- NULL,
- xmlSAX2Comment,
- xmlParserWarning,
- xmlParserError,
- xmlParserError,
- xmlSAX2GetParameterEntity,
- NULL,
- NULL,
- 0,
- };
- #endif /* LIBXML_DOCB_ENABLED */
- /**
- * xmlInitializeGlobalState:
- * @gs: a pointer to a newly allocated global state
- *
- * xmlInitializeGlobalState() initialize a global state with all the
- * default values of the library.
- */
- void
- xmlInitializeGlobalState(xmlGlobalStatePtr gs)
- {
- #ifdef DEBUG_GLOBALS
- fprintf(stderr, "Initializing globals at %lu for thread %d\n",
- (unsigned long) gs, xmlGetThreadId());
- #endif
- /*
- * Perform initialization as required by libxml
- */
- if (xmlThrDefMutex == NULL)
- xmlInitGlobals();
- xmlMutexLock(xmlThrDefMutex);
- #if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
- initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
- #endif
- #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
- inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
- #endif
- gs->oldXMLWDcompatibility = 0;
- gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
- gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
- #if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
- initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
- #endif /* LIBXML_SAX1_ENABLED */
- gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
- gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
- gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
- gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
- gs->xmlDoValidityCheckingDefaultValue =
- xmlDoValidityCheckingDefaultValueThrDef;
- #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
- gs->xmlFree = (xmlFreeFunc) xmlMemFree;
- gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
- gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
- gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
- gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
- #else
- gs->xmlFree = (xmlFreeFunc) free;
- gs->xmlMalloc = (xmlMallocFunc) malloc;
- gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
- gs->xmlRealloc = (xmlReallocFunc) realloc;
- gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
- #endif
- gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
- gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
- gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
- gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
- gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
- gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
- gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
- gs->xmlParserVersion = LIBXML_VERSION_STRING;
- gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
- gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
- gs->xmlSubstituteEntitiesDefaultValue =
- xmlSubstituteEntitiesDefaultValueThrDef;
- gs->xmlGenericError = xmlGenericErrorThrDef;
- gs->xmlStructuredError = xmlStructuredErrorThrDef;
- gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
- gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
- gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
- gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
- gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
- gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
- memset(&gs->xmlLastError, 0, sizeof(xmlError));
- xmlMutexUnlock(xmlThrDefMutex);
- }
- /**
- * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
- * those are really internal work
- */
- void
- xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
- xmlMutexLock(xmlThrDefMutex);
- xmlGenericErrorContextThrDef = ctx;
- if (handler != NULL)
- xmlGenericErrorThrDef = handler;
- else
- xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
- xmlMutexUnlock(xmlThrDefMutex);
- }
- void
- xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
- xmlMutexLock(xmlThrDefMutex);
- xmlStructuredErrorContextThrDef = ctx;
- xmlStructuredErrorThrDef = handler;
- xmlMutexUnlock(xmlThrDefMutex);
- }
- /**
- * xmlRegisterNodeDefault:
- * @func: function pointer to the new RegisterNodeFunc
- *
- * Registers a callback for node creation
- *
- * Returns the old value of the registration function
- */
- xmlRegisterNodeFunc
- xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
- {
- xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
- __xmlRegisterCallbacks = 1;
- xmlRegisterNodeDefaultValue = func;
- return(old);
- }
- xmlRegisterNodeFunc
- xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
- {
- xmlRegisterNodeFunc old;
- xmlMutexLock(xmlThrDefMutex);
- old = xmlRegisterNodeDefaultValueThrDef;
- __xmlRegisterCallbacks = 1;
- xmlRegisterNodeDefaultValueThrDef = func;
- xmlMutexUnlock(xmlThrDefMutex);
- return(old);
- }
- /**
- * xmlDeregisterNodeDefault:
- * @func: function pointer to the new DeregisterNodeFunc
- *
- * Registers a callback for node destruction
- *
- * Returns the previous value of the deregistration function
- */
- xmlDeregisterNodeFunc
- xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
- {
- xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
- __xmlRegisterCallbacks = 1;
- xmlDeregisterNodeDefaultValue = func;
- return(old);
- }
- xmlDeregisterNodeFunc
- xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
- {
- xmlDeregisterNodeFunc old;
- xmlMutexLock(xmlThrDefMutex);
- old = xmlDeregisterNodeDefaultValueThrDef;
- __xmlRegisterCallbacks = 1;
- xmlDeregisterNodeDefaultValueThrDef = func;
- xmlMutexUnlock(xmlThrDefMutex);
- return(old);
- }
- xmlParserInputBufferCreateFilenameFunc
- xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
- {
- xmlParserInputBufferCreateFilenameFunc old;
- xmlMutexLock(xmlThrDefMutex);
- old = xmlParserInputBufferCreateFilenameValueThrDef;
- if (old == NULL) {
- old = __xmlParserInputBufferCreateFilename;
- }
- xmlParserInputBufferCreateFilenameValueThrDef = func;
- xmlMutexUnlock(xmlThrDefMutex);
- return(old);
- }
- xmlOutputBufferCreateFilenameFunc
- xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
- {
- xmlOutputBufferCreateFilenameFunc old;
- xmlMutexLock(xmlThrDefMutex);
- old = xmlOutputBufferCreateFilenameValueThrDef;
- #ifdef LIBXML_OUTPUT_ENABLED
- if (old == NULL) {
- old = __xmlOutputBufferCreateFilename;
- }
- #endif
- xmlOutputBufferCreateFilenameValueThrDef = func;
- xmlMutexUnlock(xmlThrDefMutex);
- return(old);
- }
- #ifdef LIBXML_DOCB_ENABLED
- #undef docbDefaultSAXHandler
- xmlSAXHandlerV1 *
- __docbDefaultSAXHandler(void) {
- if (IS_MAIN_THREAD)
- return (&docbDefaultSAXHandler);
- else
- return (&xmlGetGlobalState()->docbDefaultSAXHandler);
- }
- #endif
- #ifdef LIBXML_HTML_ENABLED
- #undef htmlDefaultSAXHandler
- xmlSAXHandlerV1 *
- __htmlDefaultSAXHandler(void) {
- if (IS_MAIN_THREAD)
- return (&htmlDefaultSAXHandler);
- else
- return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
- }
- #endif
- #undef xmlLastError
- xmlError *
- __xmlLastError(void) {
- if (IS_MAIN_THREAD)
- return (&xmlLastError);
- else
- return (&xmlGetGlobalState()->xmlLastError);
- }
- /*
- * The following memory routines were apparently lost at some point,
- * and were re-inserted at this point on June 10, 2004. Hope it's
- * the right place for them :-)
- */
- #if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
- #undef xmlMalloc
- xmlMallocFunc *
- __xmlMalloc(void){
- if (IS_MAIN_THREAD)
- return (&xmlMalloc);
- else
- return (&xmlGetGlobalState()->xmlMalloc);
- }
- #undef xmlMallocAtomic
- xmlMallocFunc *
- __xmlMallocAtomic(void){
- if (IS_MAIN_THREAD)
- return (&xmlMallocAtomic);
- else
- return (&xmlGetGlobalState()->xmlMallocAtomic);
- }
- #undef xmlRealloc
- xmlReallocFunc *
- __xmlRealloc(void){
- if (IS_MAIN_THREAD)
- return (&xmlRealloc);
- else
- return (&xmlGetGlobalState()->xmlRealloc);
- }
- #undef xmlFree
- xmlFreeFunc *
- __xmlFree(void){
- if (IS_MAIN_THREAD)
- return (&xmlFree);
- else
- return (&xmlGetGlobalState()->xmlFree);
- }
- xmlStrdupFunc *
- __xmlMemStrdup(void){
- if (IS_MAIN_THREAD)
- return (&xmlMemStrdup);
- else
- return (&xmlGetGlobalState()->xmlMemStrdup);
- }
- #endif
- /*
- * Everything starting from the line below is
- * Automatically generated by build_glob.py.
- * Do not modify the previous line.
- */
- #undef oldXMLWDcompatibility
- int *
- __oldXMLWDcompatibility(void) {
- if (IS_MAIN_THREAD)
- return (&oldXMLWDcompatibility);
- else
- return (&xmlGetGlobalState()->oldXMLWDcompatibility);
- }
- #undef xmlBufferAllocScheme
- xmlBufferAllocationScheme *
- __xmlBufferAllocScheme(void) {
- if (IS_MAIN_THREAD)
- return (&xmlBufferAllocScheme);
- else
- return (&xmlGetGlobalState()->xmlBufferAllocScheme);
- }
- xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
- xmlBufferAllocationScheme ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlBufferAllocSchemeThrDef;
- xmlBufferAllocSchemeThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlDefaultBufferSize
- int *
- __xmlDefaultBufferSize(void) {
- if (IS_MAIN_THREAD)
- return (&xmlDefaultBufferSize);
- else
- return (&xmlGetGlobalState()->xmlDefaultBufferSize);
- }
- int xmlThrDefDefaultBufferSize(int v) {
- int ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlDefaultBufferSizeThrDef;
- xmlDefaultBufferSizeThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #ifdef LIBXML_SAX1_ENABLED
- #undef xmlDefaultSAXHandler
- xmlSAXHandlerV1 *
- __xmlDefaultSAXHandler(void) {
- if (IS_MAIN_THREAD)
- return (&xmlDefaultSAXHandler);
- else
- return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
- }
- #endif /* LIBXML_SAX1_ENABLED */
- #undef xmlDefaultSAXLocator
- xmlSAXLocator *
- __xmlDefaultSAXLocator(void) {
- if (IS_MAIN_THREAD)
- return (&xmlDefaultSAXLocator);
- else
- return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
- }
- #undef xmlDoValidityCheckingDefaultValue
- int *
- __xmlDoValidityCheckingDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlDoValidityCheckingDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
- }
- int xmlThrDefDoValidityCheckingDefaultValue(int v) {
- int ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlDoValidityCheckingDefaultValueThrDef;
- xmlDoValidityCheckingDefaultValueThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlGenericError
- xmlGenericErrorFunc *
- __xmlGenericError(void) {
- if (IS_MAIN_THREAD)
- return (&xmlGenericError);
- else
- return (&xmlGetGlobalState()->xmlGenericError);
- }
- #undef xmlStructuredError
- xmlStructuredErrorFunc *
- __xmlStructuredError(void) {
- if (IS_MAIN_THREAD)
- return (&xmlStructuredError);
- else
- return (&xmlGetGlobalState()->xmlStructuredError);
- }
- #undef xmlGenericErrorContext
- void * *
- __xmlGenericErrorContext(void) {
- if (IS_MAIN_THREAD)
- return (&xmlGenericErrorContext);
- else
- return (&xmlGetGlobalState()->xmlGenericErrorContext);
- }
- #undef xmlStructuredErrorContext
- void * *
- __xmlStructuredErrorContext(void) {
- if (IS_MAIN_THREAD)
- return (&xmlStructuredErrorContext);
- else
- return (&xmlGetGlobalState()->xmlStructuredErrorContext);
- }
- #undef xmlGetWarningsDefaultValue
- int *
- __xmlGetWarningsDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlGetWarningsDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
- }
- int xmlThrDefGetWarningsDefaultValue(int v) {
- int ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlGetWarningsDefaultValueThrDef;
- xmlGetWarningsDefaultValueThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlIndentTreeOutput
- int *
- __xmlIndentTreeOutput(void) {
- if (IS_MAIN_THREAD)
- return (&xmlIndentTreeOutput);
- else
- return (&xmlGetGlobalState()->xmlIndentTreeOutput);
- }
- int xmlThrDefIndentTreeOutput(int v) {
- int ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlIndentTreeOutputThrDef;
- xmlIndentTreeOutputThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlTreeIndentString
- const char * *
- __xmlTreeIndentString(void) {
- if (IS_MAIN_THREAD)
- return (&xmlTreeIndentString);
- else
- return (&xmlGetGlobalState()->xmlTreeIndentString);
- }
- const char * xmlThrDefTreeIndentString(const char * v) {
- const char * ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlTreeIndentStringThrDef;
- xmlTreeIndentStringThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlKeepBlanksDefaultValue
- int *
- __xmlKeepBlanksDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlKeepBlanksDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
- }
- int xmlThrDefKeepBlanksDefaultValue(int v) {
- int ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlKeepBlanksDefaultValueThrDef;
- xmlKeepBlanksDefaultValueThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlLineNumbersDefaultValue
- int *
- __xmlLineNumbersDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlLineNumbersDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
- }
- int xmlThrDefLineNumbersDefaultValue(int v) {
- int ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlLineNumbersDefaultValueThrDef;
- xmlLineNumbersDefaultValueThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlLoadExtDtdDefaultValue
- int *
- __xmlLoadExtDtdDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlLoadExtDtdDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
- }
- int xmlThrDefLoadExtDtdDefaultValue(int v) {
- int ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlLoadExtDtdDefaultValueThrDef;
- xmlLoadExtDtdDefaultValueThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlParserDebugEntities
- int *
- __xmlParserDebugEntities(void) {
- if (IS_MAIN_THREAD)
- return (&xmlParserDebugEntities);
- else
- return (&xmlGetGlobalState()->xmlParserDebugEntities);
- }
- int xmlThrDefParserDebugEntities(int v) {
- int ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlParserDebugEntitiesThrDef;
- xmlParserDebugEntitiesThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlParserVersion
- const char * *
- __xmlParserVersion(void) {
- if (IS_MAIN_THREAD)
- return (&xmlParserVersion);
- else
- return (&xmlGetGlobalState()->xmlParserVersion);
- }
- #undef xmlPedanticParserDefaultValue
- int *
- __xmlPedanticParserDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlPedanticParserDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
- }
- int xmlThrDefPedanticParserDefaultValue(int v) {
- int ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlPedanticParserDefaultValueThrDef;
- xmlPedanticParserDefaultValueThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlSaveNoEmptyTags
- int *
- __xmlSaveNoEmptyTags(void) {
- if (IS_MAIN_THREAD)
- return (&xmlSaveNoEmptyTags);
- else
- return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
- }
- int xmlThrDefSaveNoEmptyTags(int v) {
- int ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlSaveNoEmptyTagsThrDef;
- xmlSaveNoEmptyTagsThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlSubstituteEntitiesDefaultValue
- int *
- __xmlSubstituteEntitiesDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlSubstituteEntitiesDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
- }
- int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
- int ret;
- xmlMutexLock(xmlThrDefMutex);
- ret = xmlSubstituteEntitiesDefaultValueThrDef;
- xmlSubstituteEntitiesDefaultValueThrDef = v;
- xmlMutexUnlock(xmlThrDefMutex);
- return ret;
- }
- #undef xmlRegisterNodeDefaultValue
- xmlRegisterNodeFunc * XMLCALL
- __xmlRegisterNodeDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlRegisterNodeDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
- }
- #undef xmlDeregisterNodeDefaultValue
- xmlDeregisterNodeFunc * XMLCALL
- __xmlDeregisterNodeDefaultValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlDeregisterNodeDefaultValue);
- else
- return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
- }
- #undef xmlParserInputBufferCreateFilenameValue
- xmlParserInputBufferCreateFilenameFunc * XMLCALL
- __xmlParserInputBufferCreateFilenameValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlParserInputBufferCreateFilenameValue);
- else
- return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
- }
- #undef xmlOutputBufferCreateFilenameValue
- xmlOutputBufferCreateFilenameFunc * XMLCALL
- __xmlOutputBufferCreateFilenameValue(void) {
- if (IS_MAIN_THREAD)
- return (&xmlOutputBufferCreateFilenameValue);
- else
- return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
- }
- #define bottom_globals
- #include "elfgcchack.h"
|