forked from len0rd/rockbox
Next round of pdbox patches from Wincent Balin: adapt dbestfit to rockbox, ifdef some printfs, and more
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21095 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
84ea607813
commit
3ca0614de9
8 changed files with 35 additions and 10 deletions
|
@ -1,11 +1,9 @@
|
|||
pdbox.c
|
||||
pdbox-net.c
|
||||
|
||||
/*
|
||||
dbestfit-3.3/bmalloc.c
|
||||
dbestfit-3.3/bysize.c
|
||||
dbestfit-3.3/dmalloc.c
|
||||
*/
|
||||
|
||||
/*
|
||||
PDa/src/g_canvas.c
|
||||
|
|
|
@ -236,6 +236,7 @@ static void bmalloc_failed(size_t size)
|
|||
#define bmalloc_failed(x)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
void print_lists()
|
||||
{
|
||||
struct BlockInfo *block = blockHead;
|
||||
|
@ -252,6 +253,7 @@ void print_lists()
|
|||
#endif
|
||||
print_sizes();
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
void *bmalloc(size_t size)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
int add_pool(void *start, size_t size);
|
||||
void print_lists();
|
||||
void print_lists(void);
|
||||
|
||||
void *bmalloc(size_t size);
|
||||
void bfree(void *ptr);
|
||||
|
|
|
@ -366,6 +366,7 @@ Tree *removebyaddr(Tree *t, Tree *remove)
|
|||
return x;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
int printtree(Tree * t, int d, char output)
|
||||
{
|
||||
int distance=0;
|
||||
|
@ -395,6 +396,7 @@ int printtree(Tree * t, int d, char output)
|
|||
distance += printtree(t->smaller, d+1, output);
|
||||
return distance;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
/* Here follow the look-alike interface so that the tree-function names are
|
||||
the same as the list-ones to enable easy interchange */
|
||||
|
@ -416,9 +418,11 @@ char *obtainbysize( size_t size)
|
|||
return (char *)receive;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void print_sizes(void)
|
||||
{
|
||||
printtree(chunkHead, 0, 1);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,8 +23,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#define memset rb->memset
|
||||
#else /* ROCKBOX */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdarg.h>
|
||||
|
@ -156,15 +161,23 @@ struct MemInfo {
|
|||
happy with us.
|
||||
*/
|
||||
|
||||
#if BIGBLOCKS==4060 /* previously */
|
||||
#if defined(BIGBLOCKS) && BIGBLOCKS==4060 /* previously */
|
||||
#ifdef ROCKBOX
|
||||
unsigned
|
||||
#endif /* ROCKBOX */
|
||||
short qinfo[]= { 20, 28, 52, 116, 312, 580, 812, 2028 };
|
||||
#else
|
||||
#ifdef ROCKBOX
|
||||
unsigned
|
||||
#endif /* ROCKBOX */
|
||||
short qinfo[]= { 20, 28, 52, 116, 312, 580, 1016, 2032};
|
||||
/* 52 and 312 only make use of 4056 bytes, but without them there are too
|
||||
wide gaps */
|
||||
#endif
|
||||
|
||||
#ifndef ROCKBOX
|
||||
#define MIN(x,y) ((x)<(y)?(x):(y))
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Globals */
|
||||
|
@ -335,6 +348,9 @@ static void FragBlock(char *memp, int size)
|
|||
**************************************************************************/
|
||||
static void initialize(void)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
unsigned
|
||||
#endif /* ROCKBOX */
|
||||
int i;
|
||||
/* Setup the nmax and fragsize fields of the top structs */
|
||||
for(i=0; i< sizeof(qinfo)/sizeof(qinfo[0]); i++) {
|
||||
|
@ -421,7 +437,11 @@ void *dmalloc(size_t size)
|
|||
struct MemTop *memtop=NULL; /* SAFE */
|
||||
|
||||
/* Determine which queue to use */
|
||||
#ifdef ROCKBOX
|
||||
unsigned
|
||||
#endif /* ROCKBOX */
|
||||
int queue;
|
||||
|
||||
for(queue=0; size > qinfo[queue]; queue++)
|
||||
;
|
||||
do {
|
||||
|
@ -622,7 +642,7 @@ void *drealloc(char *ptr, size_t size)
|
|||
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
*/
|
||||
void *mem=NULL; /* SAFE */
|
||||
size_t prevsize;
|
||||
size_t prevsize = 0;
|
||||
|
||||
/* NOTE that this is only valid if BLOCK_BIT isn't set: */
|
||||
struct MemBlock *block;
|
||||
|
|
|
@ -5,3 +5,8 @@ void *drealloc(void *, size_t);
|
|||
#define malloc(x) dmalloc(x)
|
||||
#define free(x) dfree(x)
|
||||
#define realloc(x,y) drealloc(x,y)
|
||||
|
||||
#ifdef ROCKBOX
|
||||
void *dcalloc(size_t, size_t);
|
||||
#define calloc(x,y) dcalloc(x,y)
|
||||
#endif
|
||||
|
|
|
@ -105,7 +105,6 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
/* Get the file name. */
|
||||
const char* filename = (const char*) parameter;
|
||||
|
||||
#if 0
|
||||
/* Allocate memory; check it's size; add to the pool. */
|
||||
mem_pool = rb->plugin_get_audio_buffer(&mem_size);
|
||||
if(mem_size < MIN_MEM_SIZE)
|
||||
|
@ -114,9 +113,8 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
return PLUGIN_ERROR;
|
||||
}
|
||||
add_pool(mem_pool, mem_size);
|
||||
#endif
|
||||
|
||||
/* Initialze net. */
|
||||
/* Initialize net. */
|
||||
net_init();
|
||||
|
||||
/* Start threads. */
|
||||
|
|
|
@ -22,11 +22,9 @@
|
|||
#ifndef PDBOX_H
|
||||
#define PDBOX_H
|
||||
|
||||
#if 0
|
||||
/* Use dbestfit. */
|
||||
#include "bmalloc.h"
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
/* Minimal memory size. */
|
||||
#define MIN_MEM_SIZE (4 * 1024 * 1024)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue