From 1718cf5f8a39b922eba3ad1b3c9a9570188362b1 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sun, 3 Apr 2022 11:16:39 +0100 Subject: Convert a number of allocations to use buflib pinning Several places in the codebase implemented an ad-hoc form of pinning; they can be converted to use buflib pinning instead. Change-Id: I4450be007e80f6c9cc9f56c2929fa4b9b85ebff3 --- apps/tree.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'apps/tree.c') diff --git a/apps/tree.c b/apps/tree.c index a034fd0545..6622e1c4c2 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -314,6 +314,18 @@ struct tree_context* tree_get_context(void) return &tc; } +void tree_lock_cache(struct tree_context *t) +{ + core_pin(t->cache.name_buffer_handle); + core_pin(t->cache.entries_handle); +} + +void tree_unlock_cache(struct tree_context *t) +{ + core_unpin(t->cache.name_buffer_handle); + core_unpin(t->cache.entries_handle); +} + /* * Returns the position of a given file in the current directory * returns -1 if not found @@ -1020,9 +1032,6 @@ int rockbox_browse(struct browse_context *browse) static int move_callback(int handle, void* current, void* new) { struct tree_cache* cache = &tc.cache; - if (cache->lock_count > 0) - return BUFLIB_CB_CANNOT_MOVE; - ptrdiff_t diff = new - current; /* FIX_PTR makes sure to not accidentally update static allocations */ #define FIX_PTR(x) \ -- cgit v1.2.3