From fb43bd6fc924d49d08f558ccd4ad668720a75c74 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Mon, 29 Sep 2003 09:22:39 +0000 Subject: [PATCH] fix a compilation problem when configuring with debug but without * xmlmemory.c: fix a compilation problem when configuring with debug but without mem-debug Daniel --- ChangeLog | 5 +++ xmlmemory.c | 100 +++++++++++++++++++++++++++------------------------- 2 files changed, 57 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f4b2c90..ae03b187 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Sep 29 11:21:33 CEST 2003 Daniel Veillard + + * xmlmemory.c: fix a compilation problem when configuring + with debug but without mem-debug + Sun Sep 28 20:53:17 CEST 2003 Daniel Veillard * Makefile.am: cleanup, creating a new legacy.c module, diff --git a/xmlmemory.c b/xmlmemory.c index e20f721f..c5dc472b 100644 --- a/xmlmemory.c +++ b/xmlmemory.c @@ -45,6 +45,8 @@ #include static int xmlMemInitialized = 0; +static unsigned long debugMemSize = 0; +static unsigned long debugMaxMemSize = 0; #ifdef DEBUG_MEMORY_LOCATION void xmlMallocBreakpoint(void); @@ -107,8 +109,6 @@ typedef struct memnod { #define HDR_2_CLIENT(a) ((void *) (((char *) (a)) + RESERVE_SIZE)) -static unsigned long debugMemSize = 0; -static unsigned long debugMaxMemSize = 0; static int block=0; static int xmlMemStopAtBlock = 0; static void *xmlMemTraceBlockAt = NULL; @@ -562,52 +562,6 @@ xmlMemContentShow(FILE *fp, MEMHDR *p) } #endif -/** - * xmlMemShow: - * @fp: a FILE descriptor used as the output file - * @nr: number of entries to dump - * - * show a show display of the memory allocated, and dump - * the @nr last allocated areas which were not freed - */ - -void -xmlMemShow(FILE *fp, int nr) -{ -#ifdef MEM_LIST - MEMHDR *p; -#endif - - if (fp != NULL) - fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n", - debugMemSize, debugMaxMemSize); -#ifdef MEM_LIST - if (nr > 0) { - fprintf(fp,"NUMBER SIZE TYPE WHERE\n"); - p = memlist; - while ((p) && nr > 0) { - fprintf(fp,"%6lu %6lu ",p->mh_number,(unsigned long)p->mh_size); - switch (p->mh_type) { - case STRDUP_TYPE:fprintf(fp,"strdup() in ");break; - case MALLOC_TYPE:fprintf(fp,"malloc() in ");break; - case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break; - case REALLOC_TYPE:fprintf(fp,"realloc() in ");break; - case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break; - default:fprintf(fp," ??? in ");break; - } - if (p->mh_file != NULL) - fprintf(fp,"%s(%d)", p->mh_file, p->mh_line); - if (p->mh_tag != MEMTAG) - fprintf(fp," INVALID"); - xmlMemContentShow(fp, p); - fprintf(fp,"\n"); - nr--; - p = p->mh_next; - } - } -#endif /* MEM_LIST */ -} - /** * xmlMemDisplay: * @fp: a FILE descriptor used as the output file, if NULL, the result is @@ -717,6 +671,56 @@ static FILE *xmlMemoryDumpFile = NULL; #endif /* DEBUG_MEMORY_LOCATION */ +/** + * xmlMemShow: + * @fp: a FILE descriptor used as the output file + * @nr: number of entries to dump + * + * show a show display of the memory allocated, and dump + * the @nr last allocated areas which were not freed + */ + +void +xmlMemShow(FILE *fp, int nr) +{ +#ifdef DEBUG_MEMORY_LOCATION +#ifdef MEM_LIST + MEMHDR *p; +#endif +#endif /* DEBUG_MEMORY_LOCATION */ + + if (fp != NULL) + fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n", + debugMemSize, debugMaxMemSize); +#ifdef DEBUG_MEMORY_LOCATION +#ifdef MEM_LIST + if (nr > 0) { + fprintf(fp,"NUMBER SIZE TYPE WHERE\n"); + p = memlist; + while ((p) && nr > 0) { + fprintf(fp,"%6lu %6lu ",p->mh_number,(unsigned long)p->mh_size); + switch (p->mh_type) { + case STRDUP_TYPE:fprintf(fp,"strdup() in ");break; + case MALLOC_TYPE:fprintf(fp,"malloc() in ");break; + case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break; + case REALLOC_TYPE:fprintf(fp,"realloc() in ");break; + case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break; + default:fprintf(fp," ??? in ");break; + } + if (p->mh_file != NULL) + fprintf(fp,"%s(%d)", p->mh_file, p->mh_line); + if (p->mh_tag != MEMTAG) + fprintf(fp," INVALID"); + xmlMemContentShow(fp, p); + fprintf(fp,"\n"); + nr--; + p = p->mh_next; + } + } +#endif /* MEM_LIST */ +#endif /* DEBUG_MEMORY_LOCATION */ +} + /** * xmlMemoryDump: *