summaryrefslogtreecommitdiffstats
path: root/firmware/core_alloc.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2013-05-29 07:07:34 +0200
committerThomas Martitz <kugel@rockbox.org>2013-07-07 10:46:07 +0200
commitaf4e408555659f42db5b8c9a1d6a68143b2328da (patch)
treefaa15141187583097b8e6d2451f7a0f25ce5a33b /firmware/core_alloc.c
parentf9e47c6886a6fb69e8d25b07d256dd82e4904839 (diff)
downloadrockbox-af4e408555659f42db5b8c9a1d6a68143b2328da.tar.gz
rockbox-af4e408555659f42db5b8c9a1d6a68143b2328da.tar.bz2
rockbox-af4e408555659f42db5b8c9a1d6a68143b2328da.zip
buflib: Change buflib_available() and add buflib_allocatable().
buflib_allocatable() is what buflib_available() was before (it was in fact simply renamed). It returns the largest contiguous block of memory. This can be allocated and will definitely succeed, although larger allocations may also succeed if the buffer can be compacted and shrinked. buflib_available() now counts all free bytes, contiguous or not. This better matches the description and how the caller use it. Change-Id: I511e4eb5f4cf1821d957b3f4ef8a685ce40fe289 Reviewed-on: http://gerrit.rockbox.org/481 Reviewed-by: Thomas Martitz <kugel@rockbox.org> Tested-by: Thomas Martitz <kugel@rockbox.org>
Diffstat (limited to 'firmware/core_alloc.c')
-rw-r--r--firmware/core_alloc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/firmware/core_alloc.c b/firmware/core_alloc.c
index 47faed6e95..aa662fbee5 100644
--- a/firmware/core_alloc.c
+++ b/firmware/core_alloc.c
@@ -67,6 +67,11 @@ size_t core_available(void)
return buflib_available(&core_ctx);
}
+size_t core_allocatable(void)
+{
+ return buflib_allocatable(&core_ctx);
+}
+
int core_free(int handle)
{
return buflib_free(&core_ctx, handle);