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.h | |
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.h')
-rw-r--r-- | lib/x1000-installer/test_lib/core_alloc.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/x1000-installer/test_lib/core_alloc.h b/lib/x1000-installer/test_lib/core_alloc.h index 6fb06649fb..2c77e3c274 100644 --- a/lib/x1000-installer/test_lib/core_alloc.h +++ b/lib/x1000-installer/test_lib/core_alloc.h | |||
@@ -25,8 +25,18 @@ | |||
25 | #define CORE_ALLOC_H | 25 | #define CORE_ALLOC_H |
26 | 26 | ||
27 | #include <stddef.h> | 27 | #include <stddef.h> |
28 | #include <stdbool.h> | ||
29 | |||
30 | struct buflib_callbacks { | ||
31 | int (*move_callback)(int handle, void* current, void* new); | ||
32 | int (*shrink_callback)(int handle, unsigned hints, void* start, size_t old_size); | ||
33 | void (*sync_callback)(int handle, bool sync_on); | ||
34 | }; | ||
35 | |||
36 | extern struct buflib_callbacks buflib_ops_locked; | ||
28 | 37 | ||
29 | int core_alloc(const char* name, size_t size); | 38 | int core_alloc(const char* name, size_t size); |
39 | int core_alloc_ex(const char* name, size_t size, struct buflib_callbacks* cb); | ||
30 | int core_free(int handle); | 40 | int core_free(int handle); |
31 | void* core_get_data(int handle); | 41 | void* core_get_data(int handle); |
32 | 42 | ||