forked from len0rd/rockbox
DEBUG => DEBUG_MALLOC, the symbol is already in use!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@596 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a1d678444c
commit
d902f94313
6 changed files with 14 additions and 19 deletions
|
@ -21,7 +21,7 @@ LIBOBJS = dmalloc.o bmalloc.o bysize.o
|
||||||
|
|
||||||
# define this to talk a lot in runtime
|
# define this to talk a lot in runtime
|
||||||
# -DDEBUG_VERBOSE
|
# -DDEBUG_VERBOSE
|
||||||
CFLAGS = -g -Wall -DDEBUG
|
CFLAGS = -g -W -Wall -DDEBUG_MALLOC
|
||||||
CC = gcc
|
CC = gcc
|
||||||
AR = ar
|
AR = ar
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* #define DEBUG */
|
/* #define DEBUG_MALLOC */
|
||||||
|
|
||||||
#define BMEM_ALIGN 64 /* resolution */
|
#define BMEM_ALIGN 64 /* resolution */
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ static void bmalloc_failed(size_t size)
|
||||||
|
|
||||||
void bmalloc_status(void)
|
void bmalloc_status(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_MALLOC
|
||||||
struct BlockInfo *block = blockHead;
|
struct BlockInfo *block = blockHead;
|
||||||
long mem_free = 0;
|
long mem_free = 0;
|
||||||
long mem_used = 0;
|
long mem_used = 0;
|
||||||
|
|
|
@ -388,7 +388,7 @@ Tree *removebyaddr(Tree *t, Tree *remove)
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_MALLOC
|
||||||
static
|
static
|
||||||
int printtree(Tree * t, int d, char output)
|
int printtree(Tree * t, int d, char output)
|
||||||
{
|
{
|
||||||
|
@ -441,7 +441,7 @@ char *bmalloc_obtainbysize( size_t size)
|
||||||
return (char *)receive;
|
return (char *)receive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_MALLOC
|
||||||
void bmalloc_print_sizes(void)
|
void bmalloc_print_sizes(void)
|
||||||
{
|
{
|
||||||
printtree(chunkHead, 0, 1);
|
printtree(chunkHead, 0, 1);
|
||||||
|
|
|
@ -19,6 +19,6 @@
|
||||||
void bmalloc_remove_chunksize(void *data);
|
void bmalloc_remove_chunksize(void *data);
|
||||||
void bmalloc_insert_bysize(char *data, size_t size);
|
void bmalloc_insert_bysize(char *data, size_t size);
|
||||||
char *bmalloc_obtainbysize( size_t size);
|
char *bmalloc_obtainbysize( size_t size);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_MALLOC
|
||||||
void bmalloc_print_sizes(void);
|
void bmalloc_print_sizes(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h> /* memcpy */
|
#include <string.h> /* memcpy */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_MALLOC
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ struct MemInfo {
|
||||||
anyway: */
|
anyway: */
|
||||||
#ifdef PSOS
|
#ifdef PSOS
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_MALLOC
|
||||||
#define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)dbgmalloc(size)
|
#define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)dbgmalloc(size)
|
||||||
#define DMEM_OSFREEMEM(x) dbgfree(x)
|
#define DMEM_OSFREEMEM(x) dbgfree(x)
|
||||||
#else
|
#else
|
||||||
|
@ -126,7 +126,7 @@ struct MemInfo {
|
||||||
#ifdef BMALLOC /* use our own big-memory-allocation system */
|
#ifdef BMALLOC /* use our own big-memory-allocation system */
|
||||||
#define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)bmalloc(size)
|
#define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)bmalloc(size)
|
||||||
#define DMEM_OSFREEMEM(x) bfree(x)
|
#define DMEM_OSFREEMEM(x) bfree(x)
|
||||||
#elif DEBUG
|
#elif DEBUG_MALLOC
|
||||||
#define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)dbgmalloc(size)
|
#define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)dbgmalloc(size)
|
||||||
#define DMEM_OSFREEMEM(x) dbgfree(x)
|
#define DMEM_OSFREEMEM(x) dbgfree(x)
|
||||||
#else
|
#else
|
||||||
|
@ -177,7 +177,7 @@ static struct MemTop top[ sizeof(qinfo)/sizeof(qinfo[0]) ];
|
||||||
/* Start of the real code */
|
/* Start of the real code */
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_MALLOC
|
||||||
/************
|
/************
|
||||||
* A few functions that are verbose and tells us about the current status
|
* A few functions that are verbose and tells us about the current status
|
||||||
* of the dmalloc system
|
* of the dmalloc system
|
||||||
|
|
|
@ -17,15 +17,10 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void *dmalloc(size_t);
|
void *malloc(size_t);
|
||||||
void dfree(void *);
|
void *calloc (size_t nmemb, size_t size);
|
||||||
void *drealloc(void *, size_t);
|
void free(void *);
|
||||||
|
void *realloc(void *, size_t);
|
||||||
#define malloc(x) dmalloc(x)
|
|
||||||
#define free(x) dfree(x)
|
|
||||||
#define realloc(x,y) drealloc(x,y)
|
|
||||||
#define calloc(x,y) dcalloc(x,y)
|
|
||||||
|
|
||||||
|
|
||||||
/* use this to intialize the internals of the dmalloc engine */
|
/* use this to intialize the internals of the dmalloc engine */
|
||||||
void dmalloc_initialize(void);
|
void dmalloc_initialize(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue