ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

xmlmemory.h
Go to the documentation of this file.
00001 /*
00002  * Summary: interface for the memory allocator
00003  * Description: provides interfaces for the memory allocator,
00004  *              including debugging capabilities.
00005  *
00006  * Copy: See Copyright for the status of this software.
00007  *
00008  * Author: Daniel Veillard
00009  */
00010 
00011 
00012 #ifndef __DEBUG_MEMORY_ALLOC__
00013 #define __DEBUG_MEMORY_ALLOC__
00014 
00015 #include <stdio.h>
00016 #include <libxml/xmlversion.h>
00017 
00026 /* #define DEBUG_MEMORY_FREED */
00027 /* #define DEBUG_MEMORY_LOCATION */
00028 
00029 #ifdef DEBUG
00030 #ifndef DEBUG_MEMORY
00031 #define DEBUG_MEMORY
00032 #endif
00033 #endif
00034 
00041 #ifdef DEBUG_MEMORY_LOCATION
00042 #endif
00043 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047 
00048 /*
00049  * The XML memory wrapper support 4 basic overloadable functions.
00050  */
00057 typedef void (XMLCALL *xmlFreeFunc)(void *mem);
00066 typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
00067 
00077 typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size);
00078 
00087 typedef char *(XMLCALL *xmlStrdupFunc)(const char *str);
00088 
00089 /*
00090  * The 4 interfaces used for all memory handling within libxml.
00091 LIBXML_DLL_IMPORT xmlFreeFunc xmlFree;
00092 LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc;
00093 LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic;
00094 LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc;
00095 LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup;
00096  */
00097 
00098 /*
00099  * The way to overload the existing functions.
00100  * The xmlGc function have an extra entry for atomic block
00101  * allocations useful for garbage collected memory allocators
00102  */
00103 XMLPUBFUN int XMLCALL
00104     xmlMemSetup (xmlFreeFunc freeFunc,
00105              xmlMallocFunc mallocFunc,
00106              xmlReallocFunc reallocFunc,
00107              xmlStrdupFunc strdupFunc);
00108 XMLPUBFUN int XMLCALL
00109     xmlMemGet   (xmlFreeFunc *freeFunc,
00110              xmlMallocFunc *mallocFunc,
00111              xmlReallocFunc *reallocFunc,
00112              xmlStrdupFunc *strdupFunc);
00113 XMLPUBFUN int XMLCALL
00114     xmlGcMemSetup   (xmlFreeFunc freeFunc,
00115              xmlMallocFunc mallocFunc,
00116              xmlMallocFunc mallocAtomicFunc,
00117              xmlReallocFunc reallocFunc,
00118              xmlStrdupFunc strdupFunc);
00119 XMLPUBFUN int XMLCALL
00120     xmlGcMemGet (xmlFreeFunc *freeFunc,
00121              xmlMallocFunc *mallocFunc,
00122              xmlMallocFunc *mallocAtomicFunc,
00123              xmlReallocFunc *reallocFunc,
00124              xmlStrdupFunc *strdupFunc);
00125 
00126 /*
00127  * Initialization of the memory layer.
00128  */
00129 XMLPUBFUN int XMLCALL
00130     xmlInitMemory   (void);
00131 
00132 /*
00133  * Cleanup of the memory layer.
00134  */
00135 XMLPUBFUN void XMLCALL
00136                 xmlCleanupMemory        (void);
00137 /*
00138  * These are specific to the XML debug memory wrapper.
00139  */
00140 XMLPUBFUN int XMLCALL
00141     xmlMemUsed  (void);
00142 XMLPUBFUN int XMLCALL
00143     xmlMemBlocks    (void);
00144 XMLPUBFUN void XMLCALL
00145     xmlMemDisplay   (FILE *fp);
00146 XMLPUBFUN void XMLCALL
00147     xmlMemDisplayLast(FILE *fp, long nbBytes);
00148 XMLPUBFUN void XMLCALL
00149     xmlMemShow  (FILE *fp, int nr);
00150 XMLPUBFUN void XMLCALL
00151     xmlMemoryDump   (void);
00152 XMLPUBFUN void * XMLCALL
00153     xmlMemMalloc    (size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
00154 XMLPUBFUN void * XMLCALL
00155     xmlMemRealloc   (void *ptr,size_t size);
00156 XMLPUBFUN void XMLCALL
00157     xmlMemFree  (void *ptr);
00158 XMLPUBFUN char * XMLCALL
00159     xmlMemoryStrdup (const char *str);
00160 XMLPUBFUN void * XMLCALL
00161     xmlMallocLoc    (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
00162 XMLPUBFUN void * XMLCALL
00163     xmlReallocLoc   (void *ptr, size_t size, const char *file, int line);
00164 XMLPUBFUN void * XMLCALL
00165     xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
00166 XMLPUBFUN char * XMLCALL
00167     xmlMemStrdupLoc (const char *str, const char *file, int line);
00168 
00169 
00170 #ifdef DEBUG_MEMORY_LOCATION
00171 
00179 #define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__)
00180 
00189 #define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__)
00190 
00199 #define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__)
00200 
00208 #define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__)
00209 
00210 #endif /* DEBUG_MEMORY_LOCATION */
00211 
00212 #ifdef __cplusplus
00213 }
00214 #endif /* __cplusplus */
00215 
00216 #ifndef __XML_GLOBALS_H
00217 #ifndef __XML_THREADS_H__
00218 #include <libxml/threads.h>
00219 #include <libxml/globals.h>
00220 #endif
00221 #endif
00222 
00223 #endif  /* __DEBUG_MEMORY_ALLOC__ */
00224 

Generated on Fri May 25 2012 04:31:44 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.