diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2010-05-17 12:34:05 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2010-05-17 12:34:05 +0000 |
commit | fcf36dd4f9879a82342e5606535d2dcf46d1de2a (patch) | |
tree | 21ed249c7a6f9d0bd7e2049c7a9f9e0708ba28f8 /firmware/kernel.c | |
parent | 9fde12676b382a31a10c58e2473edfde460e4d73 (diff) | |
download | rockbox-fcf36dd4f9879a82342e5606535d2dcf46d1de2a.tar.gz rockbox-fcf36dd4f9879a82342e5606535d2dcf46d1de2a.zip |
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
Diffstat (limited to 'firmware/kernel.c')
-rw-r--r-- | firmware/kernel.c | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/firmware/kernel.c b/firmware/kernel.c index d8c67e8485..fe40c35002 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "system.h" | 27 | #include "system.h" |
28 | #include "panic.h" | 28 | #include "panic.h" |
29 | #include "debug.h" | 29 | #include "debug.h" |
30 | #include "general.h" | ||
30 | 31 | ||
31 | /* Make this nonzero to enable more elaborate checks on objects */ | 32 | /* Make this nonzero to enable more elaborate checks on objects */ |
32 | #if defined(DEBUG) || defined(SIMULATOR) | 33 | #if defined(DEBUG) || defined(SIMULATOR) |
@@ -62,40 +63,6 @@ static struct | |||
62 | } all_queues SHAREDBSS_ATTR; | 63 | } all_queues SHAREDBSS_ATTR; |
63 | 64 | ||
64 | /**************************************************************************** | 65 | /**************************************************************************** |
65 | * Common utilities | ||
66 | ****************************************************************************/ | ||
67 | |||
68 | /* Find a pointer in a pointer array. Returns the addess of the element if | ||
69 | * found or the address of the terminating NULL otherwise. */ | ||
70 | static void ** find_array_ptr(void **arr, void *ptr) | ||
71 | { | ||
72 | void *curr; | ||
73 | for(curr = *arr; curr != NULL && curr != ptr; curr = *(++arr)); | ||
74 | return arr; | ||
75 | } | ||
76 | |||
77 | /* Remove a pointer from a pointer array if it exists. Compacts it so that | ||
78 | * no gaps exist. Returns 0 on success and -1 if the element wasn't found. */ | ||
79 | static int remove_array_ptr(void **arr, void *ptr) | ||
80 | { | ||
81 | void *curr; | ||
82 | arr = find_array_ptr(arr, ptr); | ||
83 | |||
84 | if(*arr == NULL) | ||
85 | return -1; | ||
86 | |||
87 | /* Found. Slide up following items. */ | ||
88 | do | ||
89 | { | ||
90 | void **arr1 = arr + 1; | ||
91 | *arr++ = curr = *arr1; | ||
92 | } | ||
93 | while(curr != NULL); | ||
94 | |||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | /**************************************************************************** | ||
99 | * Standard kernel stuff | 66 | * Standard kernel stuff |
100 | ****************************************************************************/ | 67 | ****************************************************************************/ |
101 | void kernel_init(void) | 68 | void kernel_init(void) |