forked from len0rd/rockbox
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
This commit is contained in:
parent
95dfc489b5
commit
e8faf2f2ad
14 changed files with 43 additions and 30 deletions
|
|
@ -129,6 +129,12 @@ struct buflib_callbacks {
|
|||
void (*sync_callback)(int handle, bool sync_on);
|
||||
};
|
||||
|
||||
/** A set of all NULL callbacks for use with allocations that need to stay
|
||||
* locked in RAM and not moved or shrunk. These type of allocations should
|
||||
* be avoided as much as possible to avoid memory fragmentation but it can
|
||||
* suitable for short-lived allocations. */
|
||||
extern struct buflib_callbacks buflib_ops_locked;
|
||||
|
||||
#define BUFLIB_SHRINK_SIZE_MASK (~BUFLIB_SHRINK_POS_MASK)
|
||||
#define BUFLIB_SHRINK_POS_FRONT (1u<<31)
|
||||
#define BUFLIB_SHRINK_POS_BACK (1u<<30)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue