diff options
-rw-r--r-- | firmware/malloc/Makefile | 2 | ||||
-rw-r--r-- | firmware/malloc/bmalloc.c | 4 | ||||
-rw-r--r-- | firmware/malloc/bysize.c | 4 | ||||
-rw-r--r-- | firmware/malloc/bysize.h | 2 | ||||
-rw-r--r-- | firmware/malloc/dmalloc.c | 8 | ||||
-rw-r--r-- | firmware/malloc/dmalloc.h | 13 |
6 files changed, 14 insertions, 19 deletions
diff --git a/firmware/malloc/Makefile b/firmware/malloc/Makefile index d4c6436184..4524d0630b 100644 --- a/firmware/malloc/Makefile +++ b/firmware/malloc/Makefile | |||
@@ -21,7 +21,7 @@ LIBOBJS = dmalloc.o bmalloc.o bysize.o | |||
21 | 21 | ||
22 | # define this to talk a lot in runtime | 22 | # define this to talk a lot in runtime |
23 | # -DDEBUG_VERBOSE | 23 | # -DDEBUG_VERBOSE |
24 | CFLAGS = -g -Wall -DDEBUG | 24 | CFLAGS = -g -W -Wall -DDEBUG_MALLOC |
25 | CC = gcc | 25 | CC = gcc |
26 | AR = ar | 26 | AR = ar |
27 | 27 | ||
diff --git a/firmware/malloc/bmalloc.c b/firmware/malloc/bmalloc.c index a26c5c68a0..470ee49840 100644 --- a/firmware/malloc/bmalloc.c +++ b/firmware/malloc/bmalloc.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #define FALSE 0 | 38 | #define FALSE 0 |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | /* #define DEBUG */ | 41 | /* #define DEBUG_MALLOC */ |
42 | 42 | ||
43 | #define BMEM_ALIGN 64 /* resolution */ | 43 | #define BMEM_ALIGN 64 /* resolution */ |
44 | 44 | ||
@@ -240,7 +240,7 @@ static void bmalloc_failed(size_t size) | |||
240 | 240 | ||
241 | void bmalloc_status(void) | 241 | void bmalloc_status(void) |
242 | { | 242 | { |
243 | #ifdef DEBUG | 243 | #ifdef DEBUG_MALLOC |
244 | struct BlockInfo *block = blockHead; | 244 | struct BlockInfo *block = blockHead; |
245 | long mem_free = 0; | 245 | long mem_free = 0; |
246 | long mem_used = 0; | 246 | long mem_used = 0; |
diff --git a/firmware/malloc/bysize.c b/firmware/malloc/bysize.c index c8e2759cec..437159579c 100644 --- a/firmware/malloc/bysize.c +++ b/firmware/malloc/bysize.c | |||
@@ -388,7 +388,7 @@ Tree *removebyaddr(Tree *t, Tree *remove) | |||
388 | return x; | 388 | return x; |
389 | } | 389 | } |
390 | 390 | ||
391 | #ifdef DEBUG | 391 | #ifdef DEBUG_MALLOC |
392 | static | 392 | static |
393 | int printtree(Tree * t, int d, char output) | 393 | int printtree(Tree * t, int d, char output) |
394 | { | 394 | { |
@@ -441,7 +441,7 @@ char *bmalloc_obtainbysize( size_t size) | |||
441 | return (char *)receive; | 441 | return (char *)receive; |
442 | } | 442 | } |
443 | 443 | ||
444 | #ifdef DEBUG | 444 | #ifdef DEBUG_MALLOC |
445 | void bmalloc_print_sizes(void) | 445 | void bmalloc_print_sizes(void) |
446 | { | 446 | { |
447 | printtree(chunkHead, 0, 1); | 447 | printtree(chunkHead, 0, 1); |
diff --git a/firmware/malloc/bysize.h b/firmware/malloc/bysize.h index c4621328bf..34be8f9021 100644 --- a/firmware/malloc/bysize.h +++ b/firmware/malloc/bysize.h | |||
@@ -19,6 +19,6 @@ | |||
19 | void bmalloc_remove_chunksize(void *data); | 19 | void bmalloc_remove_chunksize(void *data); |
20 | void bmalloc_insert_bysize(char *data, size_t size); | 20 | void bmalloc_insert_bysize(char *data, size_t size); |
21 | char *bmalloc_obtainbysize( size_t size); | 21 | char *bmalloc_obtainbysize( size_t size); |
22 | #ifdef DEBUG | 22 | #ifdef DEBUG_MALLOC |
23 | void bmalloc_print_sizes(void); | 23 | void bmalloc_print_sizes(void); |
24 | #endif | 24 | #endif |
diff --git a/firmware/malloc/dmalloc.c b/firmware/malloc/dmalloc.c index cf286e54b4..28215563dc 100644 --- a/firmware/malloc/dmalloc.c +++ b/firmware/malloc/dmalloc.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <stdio.h> | 29 | #include <stdio.h> |
30 | #include <string.h> /* memcpy */ | 30 | #include <string.h> /* memcpy */ |
31 | 31 | ||
32 | #ifdef DEBUG | 32 | #ifdef DEBUG_MALLOC |
33 | #include <stdarg.h> | 33 | #include <stdarg.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
@@ -106,7 +106,7 @@ struct MemInfo { | |||
106 | anyway: */ | 106 | anyway: */ |
107 | #ifdef PSOS | 107 | #ifdef PSOS |
108 | 108 | ||
109 | #ifdef DEBUG | 109 | #ifdef DEBUG_MALLOC |
110 | #define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)dbgmalloc(size) | 110 | #define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)dbgmalloc(size) |
111 | #define DMEM_OSFREEMEM(x) dbgfree(x) | 111 | #define DMEM_OSFREEMEM(x) dbgfree(x) |
112 | #else | 112 | #else |
@@ -126,7 +126,7 @@ struct MemInfo { | |||
126 | #ifdef BMALLOC /* use our own big-memory-allocation system */ | 126 | #ifdef BMALLOC /* use our own big-memory-allocation system */ |
127 | #define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)bmalloc(size) | 127 | #define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)bmalloc(size) |
128 | #define DMEM_OSFREEMEM(x) bfree(x) | 128 | #define DMEM_OSFREEMEM(x) bfree(x) |
129 | #elif DEBUG | 129 | #elif DEBUG_MALLOC |
130 | #define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)dbgmalloc(size) | 130 | #define DMEM_OSALLOCMEM(size,pointer,type) pointer=(type)dbgmalloc(size) |
131 | #define DMEM_OSFREEMEM(x) dbgfree(x) | 131 | #define DMEM_OSFREEMEM(x) dbgfree(x) |
132 | #else | 132 | #else |
@@ -177,7 +177,7 @@ static struct MemTop top[ sizeof(qinfo)/sizeof(qinfo[0]) ]; | |||
177 | /* Start of the real code */ | 177 | /* Start of the real code */ |
178 | /* ---------------------------------------------------------------------- */ | 178 | /* ---------------------------------------------------------------------- */ |
179 | 179 | ||
180 | #ifdef DEBUG | 180 | #ifdef DEBUG_MALLOC |
181 | /************ | 181 | /************ |
182 | * A few functions that are verbose and tells us about the current status | 182 | * A few functions that are verbose and tells us about the current status |
183 | * of the dmalloc system | 183 | * of the dmalloc system |
diff --git a/firmware/malloc/dmalloc.h b/firmware/malloc/dmalloc.h index a4e0ab4f6b..3314e7e7d3 100644 --- a/firmware/malloc/dmalloc.h +++ b/firmware/malloc/dmalloc.h | |||
@@ -17,15 +17,10 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | void *dmalloc(size_t); | 20 | void *malloc(size_t); |
21 | void dfree(void *); | 21 | void *calloc (size_t nmemb, size_t size); |
22 | void *drealloc(void *, size_t); | 22 | void free(void *); |
23 | 23 | void *realloc(void *, size_t); | |
24 | #define malloc(x) dmalloc(x) | ||
25 | #define free(x) dfree(x) | ||
26 | #define realloc(x,y) drealloc(x,y) | ||
27 | #define calloc(x,y) dcalloc(x,y) | ||
28 | |||
29 | 24 | ||
30 | /* use this to intialize the internals of the dmalloc engine */ | 25 | /* use this to intialize the internals of the dmalloc engine */ |
31 | void dmalloc_initialize(void); | 26 | void dmalloc_initialize(void); |