forked from len0rd/rockbox
Simplify mpegplayer a bit and use array-based lists rather than linked lists for stream management. Move a couple useful functions to handle pointer arrays from kernel.c into general.c; mpeglayer now makes use of them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26101 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9fde12676b
commit
fcf36dd4f9
15 changed files with 199 additions and 313 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include "system.h"
|
||||
#include "panic.h"
|
||||
#include "debug.h"
|
||||
#include "general.h"
|
||||
|
||||
/* Make this nonzero to enable more elaborate checks on objects */
|
||||
#if defined(DEBUG) || defined(SIMULATOR)
|
||||
|
|
@ -61,40 +62,6 @@ static struct
|
|||
IF_COP( struct corelock cl; )
|
||||
} all_queues SHAREDBSS_ATTR;
|
||||
|
||||
/****************************************************************************
|
||||
* Common utilities
|
||||
****************************************************************************/
|
||||
|
||||
/* Find a pointer in a pointer array. Returns the addess of the element if
|
||||
* found or the address of the terminating NULL otherwise. */
|
||||
static void ** find_array_ptr(void **arr, void *ptr)
|
||||
{
|
||||
void *curr;
|
||||
for(curr = *arr; curr != NULL && curr != ptr; curr = *(++arr));
|
||||
return arr;
|
||||
}
|
||||
|
||||
/* Remove a pointer from a pointer array if it exists. Compacts it so that
|
||||
* no gaps exist. Returns 0 on success and -1 if the element wasn't found. */
|
||||
static int remove_array_ptr(void **arr, void *ptr)
|
||||
{
|
||||
void *curr;
|
||||
arr = find_array_ptr(arr, ptr);
|
||||
|
||||
if(*arr == NULL)
|
||||
return -1;
|
||||
|
||||
/* Found. Slide up following items. */
|
||||
do
|
||||
{
|
||||
void **arr1 = arr + 1;
|
||||
*arr++ = curr = *arr1;
|
||||
}
|
||||
while(curr != NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Standard kernel stuff
|
||||
****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue