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
This commit is contained in:
Aidan MacDonald 2022-04-03 11:16:39 +01:00
parent b16bae6fe6
commit 1718cf5f8a
10 changed files with 94 additions and 158 deletions

View file

@ -52,7 +52,6 @@ struct tree_cache {
int name_buffer_handle; /* handle to the name cache */
int max_entries; /* Max entries in the cache */
int name_buffer_size; /* in bytes */
volatile int lock_count; /* non-0 if buffers may not move */
};
struct browse_context {
@ -120,14 +119,10 @@ void browse_context_init(struct browse_context *browse,
int rockbox_browse(struct browse_context *browse);
int create_playlist(void);
void resume_directory(const char *dir);
static inline void tree_lock_cache(struct tree_context *t)
{
t->cache.lock_count++;
}
static inline void tree_unlock_cache(struct tree_context *t)
{
t->cache.lock_count--;
}
void tree_lock_cache(struct tree_context *t);
void tree_unlock_cache(struct tree_context *t);
#ifdef WIN32
/* it takes an int on windows */
#define getcwd_size_t int