mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +03:00
20
globals.c
20
globals.c
@@ -754,12 +754,20 @@ xmlInitGlobalState(xmlGlobalStatePtr gs) {
|
|||||||
gs->gs_xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
|
gs->gs_xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
|
||||||
gs->gs_xmlDoValidityCheckingDefaultValue =
|
gs->gs_xmlDoValidityCheckingDefaultValue =
|
||||||
xmlDoValidityCheckingDefaultValueThrDef;
|
xmlDoValidityCheckingDefaultValueThrDef;
|
||||||
#if defined(DEBUG_MEMORY_LOCATION)
|
#ifdef LIBXML_THREAD_ALLOC_ENABLED
|
||||||
gs->gs_xmlFree = (xmlFreeFunc) xmlMemFree;
|
#ifdef DEBUG_MEMORY_LOCATION
|
||||||
gs->gs_xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
|
gs->gs_xmlFree = xmlMemFree;
|
||||||
gs->gs_xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
|
gs->gs_xmlMalloc = xmlMemMalloc;
|
||||||
gs->gs_xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
|
gs->gs_xmlMallocAtomic = xmlMemMalloc;
|
||||||
gs->gs_xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
|
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
|
#endif
|
||||||
gs->gs_xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
|
gs->gs_xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
|
||||||
#ifdef LIBXML_OUTPUT_ENABLED
|
#ifdef LIBXML_OUTPUT_ENABLED
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ typedef char *(*xmlStrdupFunc)(const char *str);
|
|||||||
#define XML_OP XML_DECLARE_GLOBAL
|
#define XML_OP XML_DECLARE_GLOBAL
|
||||||
XML_GLOBALS_ALLOC
|
XML_GLOBALS_ALLOC
|
||||||
#undef XML_OP
|
#undef XML_OP
|
||||||
#ifdef LIBXML_THREAD_ENABLED
|
#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION)
|
||||||
#define xmlMalloc XML_GLOBAL_MACRO(xmlMalloc)
|
#define xmlMalloc XML_GLOBAL_MACRO(xmlMalloc)
|
||||||
#define xmlMallocAtomic XML_GLOBAL_MACRO(xmlMallocAtomic)
|
#define xmlMallocAtomic XML_GLOBAL_MACRO(xmlMallocAtomic)
|
||||||
#define xmlRealloc XML_GLOBAL_MACRO(xmlRealloc)
|
#define xmlRealloc XML_GLOBAL_MACRO(xmlRealloc)
|
||||||
|
|||||||
@@ -4431,6 +4431,10 @@ thread_specific_data(void *private_data)
|
|||||||
const char *filename = params->filename;
|
const char *filename = params->filename;
|
||||||
int okay = 1;
|
int okay = 1;
|
||||||
|
|
||||||
|
#ifdef LIBXML_THREAD_ALLOC_ENABLED
|
||||||
|
xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);
|
||||||
|
#endif
|
||||||
|
|
||||||
myDoc = xmlReadFile(filename, NULL, XML_PARSE_NOENT | XML_PARSE_DTDLOAD);
|
myDoc = xmlReadFile(filename, NULL, XML_PARSE_NOENT | XML_PARSE_DTDLOAD);
|
||||||
if (myDoc) {
|
if (myDoc) {
|
||||||
xmlFreeDoc(myDoc);
|
xmlFreeDoc(myDoc);
|
||||||
|
|||||||
@@ -579,6 +579,7 @@ xmlInitParser(void) {
|
|||||||
|
|
||||||
if (xmlParserInnerInitialized == 0) {
|
if (xmlParserInnerInitialized == 0) {
|
||||||
#if defined(_WIN32) && \
|
#if defined(_WIN32) && \
|
||||||
|
!defined(LIBXML_THREAD_ALLOC_ENABLED) && \
|
||||||
(!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
|
(!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
|
||||||
if (xmlFree == free)
|
if (xmlFree == free)
|
||||||
atexit(xmlCleanupParser);
|
atexit(xmlCleanupParser);
|
||||||
@@ -665,7 +666,9 @@ xmlCleanupParser(void) {
|
|||||||
xmlParserInnerInitialized = 0;
|
xmlParserInnerInitialized = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_ATTRIBUTE_DESTRUCTOR) && !defined(LIBXML_STATIC) && \
|
#if defined(HAVE_ATTRIBUTE_DESTRUCTOR) && \
|
||||||
|
!defined(LIBXML_THREAD_ALLOC_ENABLED) && \
|
||||||
|
!defined(LIBXML_STATIC) && \
|
||||||
!defined(_WIN32)
|
!defined(_WIN32)
|
||||||
static void
|
static void
|
||||||
ATTRIBUTE_DESTRUCTOR
|
ATTRIBUTE_DESTRUCTOR
|
||||||
|
|||||||
Reference in New Issue
Block a user