aboutsummaryrefslogtreecommitdiff
path: root/globals.c
diff options
context:
space:
mode:
Diffstat (limited to 'globals.c')
-rw-r--r--globals.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/globals.c b/globals.c
index 157f7f0c..a786a4b9 100644
--- a/globals.c
+++ b/globals.c
@@ -754,12 +754,20 @@ xmlInitGlobalState(xmlGlobalStatePtr gs) {
gs->gs_xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
gs->gs_xmlDoValidityCheckingDefaultValue =
xmlDoValidityCheckingDefaultValueThrDef;
-#if defined(DEBUG_MEMORY_LOCATION)
- gs->gs_xmlFree = (xmlFreeFunc) xmlMemFree;
- gs->gs_xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
- gs->gs_xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
- gs->gs_xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
- gs->gs_xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
+#ifdef LIBXML_THREAD_ALLOC_ENABLED
+#ifdef DEBUG_MEMORY_LOCATION
+ gs->gs_xmlFree = xmlMemFree;
+ gs->gs_xmlMalloc = xmlMemMalloc;
+ gs->gs_xmlMallocAtomic = xmlMemMalloc;
+ gs->gs_xmlRealloc = xmlMemRealloc;
+ gs->gs_xmlMemStrdup = xmlMemoryStrdup;
+#else
+ gs->gs_xmlFree = free;
+ gs->gs_xmlMalloc = malloc;
+ gs->gs_xmlMallocAtomic = malloc;
+ gs->gs_xmlRealloc = realloc;
+ gs->gs_xmlMemStrdup = xmlPosixStrdup;
+#endif
#endif
gs->gs_xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
#ifdef LIBXML_OUTPUT_ENABLED