diff options
Diffstat (limited to 'apps/plugins/pdbox/dbestfit-3.3')
-rw-r--r-- | apps/plugins/pdbox/dbestfit-3.3/bmalloc.c | 2 | ||||
-rw-r--r-- | apps/plugins/pdbox/dbestfit-3.3/bmalloc.h | 2 | ||||
-rw-r--r-- | apps/plugins/pdbox/dbestfit-3.3/bysize.c | 4 | ||||
-rw-r--r-- | apps/plugins/pdbox/dbestfit-3.3/dmalloc.c | 24 | ||||
-rw-r--r-- | apps/plugins/pdbox/dbestfit-3.3/dmalloc.h | 5 |
5 files changed, 34 insertions, 3 deletions
diff --git a/apps/plugins/pdbox/dbestfit-3.3/bmalloc.c b/apps/plugins/pdbox/dbestfit-3.3/bmalloc.c index 35cafb8f96..f0ac7312a4 100644 --- a/apps/plugins/pdbox/dbestfit-3.3/bmalloc.c +++ b/apps/plugins/pdbox/dbestfit-3.3/bmalloc.c | |||
@@ -236,6 +236,7 @@ static void bmalloc_failed(size_t size) | |||
236 | #define bmalloc_failed(x) | 236 | #define bmalloc_failed(x) |
237 | #endif | 237 | #endif |
238 | 238 | ||
239 | #ifdef DEBUG | ||
239 | void print_lists() | 240 | void print_lists() |
240 | { | 241 | { |
241 | struct BlockInfo *block = blockHead; | 242 | struct BlockInfo *block = blockHead; |
@@ -252,6 +253,7 @@ void print_lists() | |||
252 | #endif | 253 | #endif |
253 | print_sizes(); | 254 | print_sizes(); |
254 | } | 255 | } |
256 | #endif /* DEBUG */ | ||
255 | 257 | ||
256 | void *bmalloc(size_t size) | 258 | void *bmalloc(size_t size) |
257 | { | 259 | { |
diff --git a/apps/plugins/pdbox/dbestfit-3.3/bmalloc.h b/apps/plugins/pdbox/dbestfit-3.3/bmalloc.h index 550aa5a010..ab7215af0a 100644 --- a/apps/plugins/pdbox/dbestfit-3.3/bmalloc.h +++ b/apps/plugins/pdbox/dbestfit-3.3/bmalloc.h | |||
@@ -1,5 +1,5 @@ | |||
1 | int add_pool(void *start, size_t size); | 1 | int add_pool(void *start, size_t size); |
2 | void print_lists(); | 2 | void print_lists(void); |
3 | 3 | ||
4 | void *bmalloc(size_t size); | 4 | void *bmalloc(size_t size); |
5 | void bfree(void *ptr); | 5 | void bfree(void *ptr); |
diff --git a/apps/plugins/pdbox/dbestfit-3.3/bysize.c b/apps/plugins/pdbox/dbestfit-3.3/bysize.c index 85dc327491..8728e247b9 100644 --- a/apps/plugins/pdbox/dbestfit-3.3/bysize.c +++ b/apps/plugins/pdbox/dbestfit-3.3/bysize.c | |||
@@ -366,6 +366,7 @@ Tree *removebyaddr(Tree *t, Tree *remove) | |||
366 | return x; | 366 | return x; |
367 | } | 367 | } |
368 | 368 | ||
369 | #ifdef DEBUG | ||
369 | int printtree(Tree * t, int d, char output) | 370 | int printtree(Tree * t, int d, char output) |
370 | { | 371 | { |
371 | int distance=0; | 372 | int distance=0; |
@@ -395,6 +396,7 @@ int printtree(Tree * t, int d, char output) | |||
395 | distance += printtree(t->smaller, d+1, output); | 396 | distance += printtree(t->smaller, d+1, output); |
396 | return distance; | 397 | return distance; |
397 | } | 398 | } |
399 | #endif /* DEBUG */ | ||
398 | 400 | ||
399 | /* Here follow the look-alike interface so that the tree-function names are | 401 | /* Here follow the look-alike interface so that the tree-function names are |
400 | the same as the list-ones to enable easy interchange */ | 402 | the same as the list-ones to enable easy interchange */ |
@@ -416,9 +418,11 @@ char *obtainbysize( size_t size) | |||
416 | return (char *)receive; | 418 | return (char *)receive; |
417 | } | 419 | } |
418 | 420 | ||
421 | #ifdef DEBUG | ||
419 | void print_sizes(void) | 422 | void print_sizes(void) |
420 | { | 423 | { |
421 | printtree(chunkHead, 0, 1); | 424 | printtree(chunkHead, 0, 1); |
422 | } | 425 | } |
426 | #endif /* DEBUG */ | ||
423 | 427 | ||
424 | #endif | 428 | #endif |
diff --git a/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c b/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c index 6ce38cced0..bfc6bdb356 100644 --- a/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c +++ b/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c | |||
@@ -23,8 +23,13 @@ | |||
23 | * | 23 | * |
24 | *****************************************************************************/ | 24 | *****************************************************************************/ |
25 | 25 | ||
26 | #ifdef ROCKBOX | ||
27 | #include "plugin.h" | ||
28 | #define memset rb->memset | ||
29 | #else /* ROCKBOX */ | ||
26 | #include <stdio.h> | 30 | #include <stdio.h> |
27 | #include <string.h> | 31 | #include <string.h> |
32 | #endif /* ROCKBOX */ | ||
28 | 33 | ||
29 | #ifdef DEBUG | 34 | #ifdef DEBUG |
30 | #include <stdarg.h> | 35 | #include <stdarg.h> |
@@ -156,15 +161,23 @@ struct MemInfo { | |||
156 | happy with us. | 161 | happy with us. |
157 | */ | 162 | */ |
158 | 163 | ||
159 | #if BIGBLOCKS==4060 /* previously */ | 164 | #if defined(BIGBLOCKS) && BIGBLOCKS==4060 /* previously */ |
165 | #ifdef ROCKBOX | ||
166 | unsigned | ||
167 | #endif /* ROCKBOX */ | ||
160 | short qinfo[]= { 20, 28, 52, 116, 312, 580, 812, 2028 }; | 168 | short qinfo[]= { 20, 28, 52, 116, 312, 580, 812, 2028 }; |
161 | #else | 169 | #else |
170 | #ifdef ROCKBOX | ||
171 | unsigned | ||
172 | #endif /* ROCKBOX */ | ||
162 | short qinfo[]= { 20, 28, 52, 116, 312, 580, 1016, 2032}; | 173 | short qinfo[]= { 20, 28, 52, 116, 312, 580, 1016, 2032}; |
163 | /* 52 and 312 only make use of 4056 bytes, but without them there are too | 174 | /* 52 and 312 only make use of 4056 bytes, but without them there are too |
164 | wide gaps */ | 175 | wide gaps */ |
165 | #endif | 176 | #endif |
166 | 177 | ||
178 | #ifndef ROCKBOX | ||
167 | #define MIN(x,y) ((x)<(y)?(x):(y)) | 179 | #define MIN(x,y) ((x)<(y)?(x):(y)) |
180 | #endif /* ROCKBOX */ | ||
168 | 181 | ||
169 | /* ---------------------------------------------------------------------- */ | 182 | /* ---------------------------------------------------------------------- */ |
170 | /* Globals */ | 183 | /* Globals */ |
@@ -335,6 +348,9 @@ static void FragBlock(char *memp, int size) | |||
335 | **************************************************************************/ | 348 | **************************************************************************/ |
336 | static void initialize(void) | 349 | static void initialize(void) |
337 | { | 350 | { |
351 | #ifdef ROCKBOX | ||
352 | unsigned | ||
353 | #endif /* ROCKBOX */ | ||
338 | int i; | 354 | int i; |
339 | /* Setup the nmax and fragsize fields of the top structs */ | 355 | /* Setup the nmax and fragsize fields of the top structs */ |
340 | for(i=0; i< sizeof(qinfo)/sizeof(qinfo[0]); i++) { | 356 | for(i=0; i< sizeof(qinfo)/sizeof(qinfo[0]); i++) { |
@@ -421,7 +437,11 @@ void *dmalloc(size_t size) | |||
421 | struct MemTop *memtop=NULL; /* SAFE */ | 437 | struct MemTop *memtop=NULL; /* SAFE */ |
422 | 438 | ||
423 | /* Determine which queue to use */ | 439 | /* Determine which queue to use */ |
440 | #ifdef ROCKBOX | ||
441 | unsigned | ||
442 | #endif /* ROCKBOX */ | ||
424 | int queue; | 443 | int queue; |
444 | |||
425 | for(queue=0; size > qinfo[queue]; queue++) | 445 | for(queue=0; size > qinfo[queue]; queue++) |
426 | ; | 446 | ; |
427 | do { | 447 | do { |
@@ -622,7 +642,7 @@ void *drealloc(char *ptr, size_t size) | |||
622 | * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 642 | * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
623 | */ | 643 | */ |
624 | void *mem=NULL; /* SAFE */ | 644 | void *mem=NULL; /* SAFE */ |
625 | size_t prevsize; | 645 | size_t prevsize = 0; |
626 | 646 | ||
627 | /* NOTE that this is only valid if BLOCK_BIT isn't set: */ | 647 | /* NOTE that this is only valid if BLOCK_BIT isn't set: */ |
628 | struct MemBlock *block; | 648 | struct MemBlock *block; |
diff --git a/apps/plugins/pdbox/dbestfit-3.3/dmalloc.h b/apps/plugins/pdbox/dbestfit-3.3/dmalloc.h index 9921e3b94a..6a0c993815 100644 --- a/apps/plugins/pdbox/dbestfit-3.3/dmalloc.h +++ b/apps/plugins/pdbox/dbestfit-3.3/dmalloc.h | |||
@@ -5,3 +5,8 @@ void *drealloc(void *, size_t); | |||
5 | #define malloc(x) dmalloc(x) | 5 | #define malloc(x) dmalloc(x) |
6 | #define free(x) dfree(x) | 6 | #define free(x) dfree(x) |
7 | #define realloc(x,y) drealloc(x,y) | 7 | #define realloc(x,y) drealloc(x,y) |
8 | |||
9 | #ifdef ROCKBOX | ||
10 | void *dcalloc(size_t, size_t); | ||
11 | #define calloc(x,y) dcalloc(x,y) | ||
12 | #endif | ||