From c14c53a3645d81281058d4bb4cff24fa8d6faf33 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 6 Jul 2004 12:57:17 +0000 Subject: Load /tmp/tmp.DIvcnD/libxml2-2.6.11 into packages/libxml2/branches/upstream/current. --- globals.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 121 insertions(+), 6 deletions(-) (limited to 'globals.c') diff --git a/globals.c b/globals.c index f1aa150..2105157 100644 --- a/globals.c +++ b/globals.c @@ -71,6 +71,12 @@ void xmlCleanupGlobals() /* * Memory allocation routines */ +#undef xmlFree +#undef xmlMalloc +#undef xmlMallocAtomic +#undef xmlMemStrdup +#undef xmlRealloc + #if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY) #ifndef __DEBUG_MEMORY_ALLOC__ extern void xmlMemFree(void *ptr); @@ -163,12 +169,8 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; #undef xmlDeregisterNodeDefaultValue #undef xmlLastError -#undef xmlFree -#undef xmlMalloc -#undef xmlMallocAtomic -#undef xmlMemStrdup -#undef xmlRealloc - +#undef xmlParserInputBufferCreateFilenameValue +#undef xmlOutputBufferCreateFilenameValue /** * xmlParserVersion: * @@ -282,6 +284,12 @@ 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 */ @@ -545,6 +553,9 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs) gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef; gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef; gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef; + + gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef; + gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef; memset(&gs->xmlLastError, 0, sizeof(xmlError)); xmlMutexUnlock(xmlThrDefMutex); @@ -639,6 +650,40 @@ xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func) 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 @@ -671,6 +716,58 @@ __xmlLastError(void) { 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. @@ -981,3 +1078,21 @@ __xmlDeregisterNodeDefaultValue(void) { else return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue); } + +#undef xmlParserInputBufferCreateFilenameValue +xmlParserInputBufferCreateFilenameFunc * +__xmlParserInputBufferCreateFilenameValue(void) { + if (IS_MAIN_THREAD) + return (&xmlParserInputBufferCreateFilenameValue); + else + return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue); +} + +#undef xmlOutputBufferCreateFilenameValue +xmlOutputBufferCreateFilenameFunc * +__xmlOutputBufferCreateFilenameValue(void) { + if (IS_MAIN_THREAD) + return (&xmlOutputBufferCreateFilenameValue); + else + return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue); +} -- cgit v1.2.3