summaryrefslogtreecommitdiffstats
path: root/apps/tree.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-08-30 14:01:33 +0000
committerThomas Martitz <kugel@rockbox.org>2011-08-30 14:01:33 +0000
commitd0b72e25903574acb1cf9184a6052cdd646dbc37 (patch)
tree5be8db5ee00b2a727e4821cf51a5f7bcf3991073 /apps/tree.c
parentc940811ade7d99a0e0d414df7c6509672413684a (diff)
downloadrockbox-d0b72e25903574acb1cf9184a6052cdd646dbc37.tar.gz
rockbox-d0b72e25903574acb1cf9184a6052cdd646dbc37.zip
GSoC/Buflib: Add buflib memory alocator to the core.
The buflib memory allocator is handle based and can free and compact, move or resize memory on demand. This allows to effeciently allocate memory dynamically without an MMU, by avoiding fragmentation through memory compaction. This patch adds the buflib library to the core, along with convinience wrappers to omit the context parameter. Compaction is not yet enabled, but will be in a later patch. Therefore, this acts as a replacement for buffer_alloc/buffer_get_buffer() with the benifit of a debug menu. See buflib.h for some API documentation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30380 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/tree.c b/apps/tree.c
index e981aeecfc..211ddb2f9b 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -46,7 +46,7 @@
#include "keyboard.h"
#include "bookmark.h"
#include "onplay.h"
-#include "buffer.h"
+#include "core_alloc.h"
#include "power.h"
#include "action.h"
#include "talk.h"
@@ -1002,6 +1002,7 @@ int rockbox_browse(struct browse_context *browse)
void tree_mem_init(void)
{
/* initialize tree context struct */
+ int handle;
struct tree_cache* cache = &tc.cache;
memset(&tc, 0, sizeof(tc));
tc.dirfilter = &global_settings.dirfilter;
@@ -1009,10 +1010,12 @@ void tree_mem_init(void)
cache->name_buffer_size = AVERAGE_FILENAME_LENGTH *
global_settings.max_files_in_dir;
- cache->name_buffer = buffer_alloc(cache->name_buffer_size);
+ handle = core_alloc("tree names", cache->name_buffer_size);
+ cache->name_buffer = core_get_data(handle);
cache->max_entries = global_settings.max_files_in_dir;
- cache->entries = buffer_alloc(cache->max_entries*(sizeof(struct entry)));
+ handle = core_alloc("tree entries", cache->max_entries*(sizeof(struct entry)));
+ cache->entries = core_get_data(handle);
tree_get_filetypes(&filetypes, &filetypes_count);
}