diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-04-03 11:16:39 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-10-16 14:50:39 +0100 |
commit | 1718cf5f8a39b922eba3ad1b3c9a9570188362b1 (patch) | |
tree | 4f6bf81cb4f382ca04856b98492289825133c5ae /apps/tree.c | |
parent | b16bae6fe624d30631bf83290e204197ab136c12 (diff) | |
download | rockbox-1718cf5f8a39b922eba3ad1b3c9a9570188362b1.tar.gz rockbox-1718cf5f8a39b922eba3ad1b3c9a9570188362b1.zip |
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
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 15 |
1 files changed, 12 insertions, 3 deletions
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) | |||
314 | return &tc; | 314 | return &tc; |
315 | } | 315 | } |
316 | 316 | ||
317 | void tree_lock_cache(struct tree_context *t) | ||
318 | { | ||
319 | core_pin(t->cache.name_buffer_handle); | ||
320 | core_pin(t->cache.entries_handle); | ||
321 | } | ||
322 | |||
323 | void tree_unlock_cache(struct tree_context *t) | ||
324 | { | ||
325 | core_unpin(t->cache.name_buffer_handle); | ||
326 | core_unpin(t->cache.entries_handle); | ||
327 | } | ||
328 | |||
317 | /* | 329 | /* |
318 | * Returns the position of a given file in the current directory | 330 | * Returns the position of a given file in the current directory |
319 | * returns -1 if not found | 331 | * returns -1 if not found |
@@ -1020,9 +1032,6 @@ int rockbox_browse(struct browse_context *browse) | |||
1020 | static int move_callback(int handle, void* current, void* new) | 1032 | static int move_callback(int handle, void* current, void* new) |
1021 | { | 1033 | { |
1022 | struct tree_cache* cache = &tc.cache; | 1034 | struct tree_cache* cache = &tc.cache; |
1023 | if (cache->lock_count > 0) | ||
1024 | return BUFLIB_CB_CANNOT_MOVE; | ||
1025 | |||
1026 | ptrdiff_t diff = new - current; | 1035 | ptrdiff_t diff = new - current; |
1027 | /* FIX_PTR makes sure to not accidentally update static allocations */ | 1036 | /* FIX_PTR makes sure to not accidentally update static allocations */ |
1028 | #define FIX_PTR(x) \ | 1037 | #define FIX_PTR(x) \ |