mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-01 10:06:59 +03:00
better fix, avoids breaking the python bindings Daniel
* xmlmemory.c: better fix, avoids breaking the python bindings Daniel
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
Mon Sep 29 12:53:56 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xmlmemory.c: better fix, avoids breaking the python bindings
|
||||||
|
|
||||||
Mon Sep 29 11:21:33 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
Mon Sep 29 11:21:33 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* xmlmemory.c: fix a compilation problem when configuring
|
* xmlmemory.c: fix a compilation problem when configuring
|
||||||
|
19
xmlmemory.c
19
xmlmemory.c
@ -36,9 +36,11 @@
|
|||||||
* keep track of all allocated blocks for error reporting
|
* keep track of all allocated blocks for error reporting
|
||||||
* Always build the memory list !
|
* Always build the memory list !
|
||||||
*/
|
*/
|
||||||
|
#ifdef DEBUG_MEMORY_LOCATION
|
||||||
#ifndef MEM_LIST
|
#ifndef MEM_LIST
|
||||||
#define MEM_LIST /* keep a list of all the allocated memory blocks */
|
#define MEM_LIST /* keep a list of all the allocated memory blocks */
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <libxml/xmlmemory.h>
|
#include <libxml/xmlmemory.h>
|
||||||
#include <libxml/globals.h>
|
#include <libxml/globals.h>
|
||||||
@ -48,7 +50,6 @@ static int xmlMemInitialized = 0;
|
|||||||
static unsigned long debugMemSize = 0;
|
static unsigned long debugMemSize = 0;
|
||||||
static unsigned long debugMaxMemSize = 0;
|
static unsigned long debugMaxMemSize = 0;
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY_LOCATION
|
|
||||||
void xmlMallocBreakpoint(void);
|
void xmlMallocBreakpoint(void);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -669,8 +670,6 @@ static void debugmem_tag_error(void *p)
|
|||||||
|
|
||||||
static FILE *xmlMemoryDumpFile = NULL;
|
static FILE *xmlMemoryDumpFile = NULL;
|
||||||
|
|
||||||
#endif /* DEBUG_MEMORY_LOCATION */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlMemShow:
|
* xmlMemShow:
|
||||||
* @fp: a FILE descriptor used as the output file
|
* @fp: a FILE descriptor used as the output file
|
||||||
@ -681,18 +680,15 @@ static FILE *xmlMemoryDumpFile = NULL;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
xmlMemShow(FILE *fp, int nr)
|
xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_MEMORY_LOCATION
|
|
||||||
#ifdef MEM_LIST
|
#ifdef MEM_LIST
|
||||||
MEMHDR *p;
|
MEMHDR *p;
|
||||||
#endif
|
#endif
|
||||||
#endif /* DEBUG_MEMORY_LOCATION */
|
|
||||||
|
|
||||||
if (fp != NULL)
|
if (fp != NULL)
|
||||||
fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
|
fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
|
||||||
debugMemSize, debugMaxMemSize);
|
debugMemSize, debugMaxMemSize);
|
||||||
#ifdef DEBUG_MEMORY_LOCATION
|
|
||||||
#ifdef MEM_LIST
|
#ifdef MEM_LIST
|
||||||
if (nr > 0) {
|
if (nr > 0) {
|
||||||
fprintf(fp,"NUMBER SIZE TYPE WHERE\n");
|
fprintf(fp,"NUMBER SIZE TYPE WHERE\n");
|
||||||
@ -718,7 +714,6 @@ xmlMemShow(FILE *fp, int nr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* MEM_LIST */
|
#endif /* MEM_LIST */
|
||||||
#endif /* DEBUG_MEMORY_LOCATION */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -730,7 +725,7 @@ xmlMemShow(FILE *fp, int nr)
|
|||||||
void
|
void
|
||||||
xmlMemoryDump(void)
|
xmlMemoryDump(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_MEMORY_LOCATION
|
#ifdef MEM_LIST
|
||||||
FILE *dump;
|
FILE *dump;
|
||||||
|
|
||||||
if (debugMaxMemSize == 0)
|
if (debugMaxMemSize == 0)
|
||||||
@ -743,7 +738,7 @@ xmlMemoryDump(void)
|
|||||||
xmlMemDisplay(xmlMemoryDumpFile);
|
xmlMemDisplay(xmlMemoryDumpFile);
|
||||||
|
|
||||||
if (dump != NULL) fclose(dump);
|
if (dump != NULL) fclose(dump);
|
||||||
#endif /* DEBUG_MEMORY_LOCATION */
|
#endif /* MEM_LIST */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -765,15 +760,12 @@ static int xmlInitMemoryDone = 0;
|
|||||||
int
|
int
|
||||||
xmlInitMemory(void)
|
xmlInitMemory(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_MEMORY_LOCATION
|
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
char *breakpoint;
|
char *breakpoint;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (xmlInitMemoryDone) return(-1);
|
if (xmlInitMemoryDone) return(-1);
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY_LOCATION
|
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
breakpoint = getenv("XML_MEM_BREAKPOINT");
|
breakpoint = getenv("XML_MEM_BREAKPOINT");
|
||||||
if (breakpoint != NULL) {
|
if (breakpoint != NULL) {
|
||||||
@ -786,7 +778,6 @@ xmlInitMemory(void)
|
|||||||
sscanf(breakpoint, "%p", &xmlMemTraceBlockAt);
|
sscanf(breakpoint, "%p", &xmlMemTraceBlockAt);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* DEBUG_MEMORY_LOCATION */
|
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY
|
#ifdef DEBUG_MEMORY
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
Reference in New Issue
Block a user