From fcf36dd4f9879a82342e5606535d2dcf46d1de2a Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Mon, 17 May 2010 12:34:05 +0000 Subject: 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 --- firmware/export/general.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'firmware/export/general.h') diff --git a/firmware/export/general.h b/firmware/export/general.h index 8da4a0ad59..16c824086b 100644 --- a/firmware/export/general.h +++ b/firmware/export/general.h @@ -72,4 +72,19 @@ char *create_datetime_filename(char *buffer, const char *path, bool unique_time); #endif /* CONFIG_RTC */ +/*** + ** Compacted pointer lists + ** + ** N-length list requires N+1 elements to ensure NULL-termination. + **/ + +/* Find a pointer in a pointer array. Returns the addess of the element if + found or the address of the terminating NULL otherwise. This can be used + to bounds check and add items. */ +void ** find_array_ptr(void **arr, void *ptr); + +/* 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. */ +int remove_array_ptr(void **arr, void *ptr); + #endif /* GENERAL_H */ -- cgit v1.2.3