mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-23 01:52:48 +03:00
added xmlMallocAtomic() to be used when allocating blocks which do not
* DOCBparser.c HTMLparser.c c14n.c catalog.c encoding.c globals.c nanohttp.c parser.c parserInternals.c relaxng.c tree.c uri.c xmlmemory.c xmlreader.c xmlregexp.c xpath.c xpointer.c include/libxml/globals.h include/libxml/xmlmemory.h: added xmlMallocAtomic() to be used when allocating blocks which do not contains pointers, add xmlGcMemSetup() and xmlGcMemGet() to allow registering the full set of functions needed by a garbage collecting allocator like libgc, ref #109944 Daniel
This commit is contained in:
@@ -45,6 +45,7 @@ extern "C" {
|
||||
#undef xmlLineNumbersDefaultValue
|
||||
#undef xmlLoadExtDtdDefaultValue
|
||||
#undef xmlMalloc
|
||||
#undef xmlMallocAtomic
|
||||
#undef xmlMemStrdup
|
||||
#undef xmlParserDebugEntities
|
||||
#undef xmlParserVersion
|
||||
@@ -97,6 +98,8 @@ struct _xmlGlobalState
|
||||
|
||||
xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
|
||||
xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
|
||||
|
||||
xmlMallocFunc xmlMallocAtomic;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -116,6 +119,7 @@ xmlDeregisterNodeFunc xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
|
||||
* In general the memory allocation entry points are not kept
|
||||
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
|
||||
* - xmlMalloc
|
||||
* - xmlMallocAtomic
|
||||
* - xmlRealloc
|
||||
* - xmlMemStrdup
|
||||
* - xmlFree
|
||||
@@ -130,6 +134,14 @@ extern xmlMallocFunc *__xmlMalloc(void);
|
||||
LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_THREAD_ENABLED
|
||||
extern xmlMallocFunc *__xmlMallocAtomic(void);
|
||||
#define xmlMallocAtomic \
|
||||
(*(__xmlMallocAtomic()))
|
||||
#else
|
||||
LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMallocAtomic;
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_THREAD_ENABLED
|
||||
extern xmlReallocFunc *__xmlRealloc(void);
|
||||
#define xmlRealloc \
|
||||
@@ -153,8 +165,10 @@ extern xmlStrdupFunc *__xmlMemStrdup(void);
|
||||
#else
|
||||
LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
|
||||
#endif
|
||||
|
||||
#else /* !LIBXML_THREAD_ALLOC_ENABLED */
|
||||
LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
|
||||
LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMallocAtomic;
|
||||
LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
|
||||
LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
|
||||
LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
|
||||
|
Reference in New Issue
Block a user