summaryrefslogtreecommitdiff
path: root/globals.c
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2004-07-06 12:57:17 +0000
committerMike Hommey <mh@glandium.org>2004-07-06 12:57:17 +0000
commitc14c53a3645d81281058d4bb4cff24fa8d6faf33 (patch)
tree29bccc2e7499af078a3d1cdcfb517a1dee891be5 /globals.c
parentd4e028c96af89ade493b440d4f2de6b684c03a06 (diff)
downloadlibxml2-c14c53a3645d81281058d4bb4cff24fa8d6faf33.tar.gz
Load /tmp/tmp.DIvcnD/libxml2-2.6.11 intoupstream/2.6.11
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'globals.c')
-rw-r--r--globals.c127
1 files changed, 121 insertions, 6 deletions
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
@@ -672,6 +717,58 @@ __xmlLastError(void) {
}
/*
+ * 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.
@@ -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);
+}