15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/*
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Summary: interface for the memory allocator
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Description: provides interfaces for the memory allocator,
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *              including debugging capabilities.
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Copy: See Copyright for the status of this software.
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Author: Daniel Veillard
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef __DEBUG_MEMORY_ALLOC__
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define __DEBUG_MEMORY_ALLOC__
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <stdio.h>
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <libxml/xmlversion.h>
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * DEBUG_MEMORY:
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * DEBUG_MEMORY replaces the allocator with a collect and debug
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * shell to the libc allocator.
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * DEBUG_MEMORY should only be activated when debugging
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * libxml i.e. if libxml has been configured with --with-debug-mem too.
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* #define DEBUG_MEMORY_FREED */
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* #define DEBUG_MEMORY_LOCATION */
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifdef DEBUG
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef DEBUG_MEMORY
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define DEBUG_MEMORY
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * DEBUG_MEMORY_LOCATION:
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * DEBUG_MEMORY_LOCATION should be activated only when debugging
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * libxml i.e. if libxml has been configured with --with-debug-mem too.
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifdef DEBUG_MEMORY_LOCATION
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifdef __cplusplus
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern "C" {
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/*
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The XML memory wrapper support 4 basic overloadable functions.
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * xmlFreeFunc:
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @mem: an already allocated block of memory
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Signature for a free() implementation.
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef void (XMLCALL *xmlFreeFunc)(void *mem);
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * xmlMallocFunc:
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @size:  the size requested in bytes
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Signature for a malloc() implementation.
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Returns a pointer to the newly allocated block or NULL in case of error.
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * xmlReallocFunc:
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @mem: an already allocated block of memory
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @size:  the new size requested in bytes
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Signature for a realloc() implementation.
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Returns a pointer to the newly reallocated block or NULL in case of error.
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size);
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * xmlStrdupFunc:
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @str: a zero terminated string
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Signature for an strdup() implementation.
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Returns the copy of the string or NULL in case of error.
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef char *(XMLCALL *xmlStrdupFunc)(const char *str);
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/*
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The 4 interfaces used for all memory handling within libxml.
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LIBXML_DLL_IMPORT xmlFreeFunc xmlFree;
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc;
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic;
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc;
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup;
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/*
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The way to overload the existing functions.
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The xmlGc function have an extra entry for atomic block
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * allocations useful for garbage collected memory allocators
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN int XMLCALL
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemSetup	(xmlFreeFunc freeFunc,
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlMallocFunc mallocFunc,
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlReallocFunc reallocFunc,
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlStrdupFunc strdupFunc);
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN int XMLCALL
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemGet	(xmlFreeFunc *freeFunc,
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlMallocFunc *mallocFunc,
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlReallocFunc *reallocFunc,
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlStrdupFunc *strdupFunc);
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN int XMLCALL
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlGcMemSetup	(xmlFreeFunc freeFunc,
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlMallocFunc mallocFunc,
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlMallocFunc mallocAtomicFunc,
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlReallocFunc reallocFunc,
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlStrdupFunc strdupFunc);
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN int XMLCALL
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlGcMemGet	(xmlFreeFunc *freeFunc,
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlMallocFunc *mallocFunc,
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlMallocFunc *mallocAtomicFunc,
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlReallocFunc *reallocFunc,
1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			 xmlStrdupFunc *strdupFunc);
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/*
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Initialization of the memory layer.
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN int XMLCALL
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlInitMemory	(void);
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/*
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Cleanup of the memory layer.
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN void XMLCALL
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                xmlCleanupMemory        (void);
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/*
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * These are specific to the XML debug memory wrapper.
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN int XMLCALL
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemUsed	(void);
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN int XMLCALL
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemBlocks	(void);
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN void XMLCALL
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemDisplay	(FILE *fp);
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN void XMLCALL
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemDisplayLast(FILE *fp, long nbBytes);
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN void XMLCALL
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemShow	(FILE *fp, int nr);
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN void XMLCALL
1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemoryDump	(void);
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN void * XMLCALL
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemMalloc	(size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN void * XMLCALL
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemRealloc	(void *ptr,size_t size);
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN void XMLCALL
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemFree	(void *ptr);
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN char * XMLCALL
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemoryStrdup	(const char *str);
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN void * XMLCALL
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMallocLoc	(size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN void * XMLCALL
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlReallocLoc	(void *ptr, size_t size, const char *file, int line);
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN void * XMLCALL
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)XMLPUBFUN char * XMLCALL
1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	xmlMemStrdupLoc	(const char *str, const char *file, int line);
1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifdef DEBUG_MEMORY_LOCATION
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * xmlMalloc:
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @size:  number of bytes to allocate
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Wrapper for the malloc() function used in the XML library.
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Returns the pointer to the allocated area or NULL in case of error.
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__)
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * xmlMallocAtomic:
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @size:  number of bytes to allocate
1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Wrapper for the malloc() function used in the XML library for allocation
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * of block not containing pointers to other areas.
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Returns the pointer to the allocated area or NULL in case of error.
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__)
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * xmlRealloc:
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @ptr:  pointer to the existing allocated area
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @size:  number of bytes to allocate
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Wrapper for the realloc() function used in the XML library.
1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Returns the pointer to the allocated area or NULL in case of error.
1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__)
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * xmlMemStrdup:
2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @str:  pointer to the existing string
2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Wrapper for the strdup() function, xmlStrdup() is usually preferred.
2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Returns the pointer to the allocated area or NULL in case of error.
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__)
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif /* DEBUG_MEMORY_LOCATION */
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifdef __cplusplus
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif /* __cplusplus */
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef __XML_GLOBALS_H
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef __XML_THREADS_H__
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <libxml/threads.h>
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <libxml/globals.h>
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  /* __DEBUG_MEMORY_ALLOC__ */
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
225