From e8faf2f2adeb9066de3c968a57803bb262f61ee1 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Tue, 18 Jan 2022 18:57:06 +0000 Subject: buflib: add a common dummy callbacks struct & use it There are various allocations that can't be moved or shrunk. Provide a global callback struct for this use case instead of making each caller declare its own dummy struct. Also fixed ROLO and x1000 installer code which incorrectly used movable allocations. Change-Id: I00088396b9826e02e69a4a33477fe1a7816374f1 --- apps/playlist.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'apps/playlist.c') diff --git a/apps/playlist.c b/apps/playlist.c index e93feb6abb..a7b16d8b1b 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -2076,13 +2076,10 @@ int playlist_create(const char *dir, const char *file) if (file) { - /* dummy ops with no callbacks, needed because by - * default buflib buffers can be moved around which must be avoided */ - static struct buflib_callbacks dummy_ops; int handle; size_t buflen; /* use mp3 buffer for maximum load speed */ - handle = core_alloc_maximum("temp", &buflen, &dummy_ops); + handle = core_alloc_maximum("temp", &buflen, &buflib_ops_locked); if (handle > 0) { /* load the playlist file */ @@ -2119,13 +2116,10 @@ int playlist_resume(void) bool sorted = true; int result = -1; - /* dummy ops with no callbacks, needed because by - * default buflib buffers can be moved around which must be avoided */ - static struct buflib_callbacks dummy_ops; /* use mp3 buffer for maximum load speed */ if (core_allocatable() < (1 << 10)) talk_buffer_set_policy(TALK_BUFFER_LOOSE); /* back off voice buffer */ - handle = core_alloc_maximum("temp", &buflen, &dummy_ops); + handle = core_alloc_maximum("temp", &buflen, &buflib_ops_locked); if (handle < 0) { splashf(HZ * 2, "%s(): OOM", __func__); -- cgit v1.2.3