diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-01-18 18:57:06 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-02-12 10:24:32 -0500 |
commit | e8faf2f2adeb9066de3c968a57803bb262f61ee1 (patch) | |
tree | 130c2e3d904da7876ac88ea089f85f48cab5e313 /lib/x1000-installer/test_lib/core_alloc.c | |
parent | 95dfc489b5a602f68202b206c434f8485e9d3915 (diff) | |
download | rockbox-e8faf2f2adeb9066de3c968a57803bb262f61ee1.tar.gz rockbox-e8faf2f2adeb9066de3c968a57803bb262f61ee1.zip |
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
Diffstat (limited to 'lib/x1000-installer/test_lib/core_alloc.c')
-rw-r--r-- | lib/x1000-installer/test_lib/core_alloc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/x1000-installer/test_lib/core_alloc.c b/lib/x1000-installer/test_lib/core_alloc.c index 5d4edb03f7..719670f8f2 100644 --- a/lib/x1000-installer/test_lib/core_alloc.c +++ b/lib/x1000-installer/test_lib/core_alloc.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #define N_POINTERS 100 | 25 | #define N_POINTERS 100 |
26 | 26 | ||
27 | static void* pointers[N_POINTERS]; | 27 | static void* pointers[N_POINTERS]; |
28 | struct buflib_callbacks buflib_ops_locked = {NULL, NULL, NULL}; | ||
28 | 29 | ||
29 | int core_alloc(const char* name, size_t size) | 30 | int core_alloc(const char* name, size_t size) |
30 | { | 31 | { |
@@ -46,6 +47,12 @@ int core_alloc(const char* name, size_t size) | |||
46 | return -1; | 47 | return -1; |
47 | } | 48 | } |
48 | 49 | ||
50 | int core_alloc_ex(const char* name, size_t size, struct buflib_callbacks* cb) | ||
51 | { | ||
52 | (void)cb; | ||
53 | return core_alloc(name, size); | ||
54 | } | ||
55 | |||
49 | int core_free(int handle) | 56 | int core_free(int handle) |
50 | { | 57 | { |
51 | if(handle > 0) { | 58 | if(handle > 0) { |