mirror of
https://github.com/devkitPro/wut.git
synced 2026-12-04 23:10:51 -06:00
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
* Add and apply some allocation-related attributes `WUT_ALLOC_SIZE` was left off `MEMAllocFromExpHeapEx` because the allocated region may be resized via `MEMResizeForMBlockExpHeap`, but is always accessed via the same pointer. Some functions had to have the free and allocate function order swapped because the two-parameter `malloc` attribute relies on declaration order * Add attrs to `MEMAllocFromDefaultHeapFn` and `MEMAllocFromDefaultHeapExFn` * Add attrs to `MEMAllocFromBlockHeapEx`, `MEMAllocFromBlockHeapAt` and `MEMAllocFromFrmHeapEx` * whoops * Add attrs to `MEMAllocFromUnitHeap` * Formatting * Fix doxygen expansion
49 lines
1.2 KiB
C
49 lines
1.2 KiB
C
#pragma once
|
|
#include <wut.h>
|
|
#include "memheap.h"
|
|
|
|
/**
|
|
* \defgroup coreinit_memdefaultheap Default Heap
|
|
* \ingroup coreinit
|
|
* @{
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef WUT_ALLOC_SIZE(1) void *(*MEMAllocFromDefaultHeapFn)(uint32_t size);
|
|
typedef WUT_ALLOC_SIZE(1) WUT_ALLOC_ALIGN(2) void *(*MEMAllocFromDefaultHeapExFn)(uint32_t size, int32_t alignment);
|
|
typedef void (*MEMFreeToDefaultHeapFn)(void *ptr);
|
|
|
|
extern MEMAllocFromDefaultHeapFn MEMAllocFromDefaultHeap;
|
|
extern MEMAllocFromDefaultHeapExFn MEMAllocFromDefaultHeapEx;
|
|
extern MEMFreeToDefaultHeapFn MEMFreeToDefaultHeap;
|
|
|
|
/**
|
|
* Default implementation of __preinit_user.
|
|
*/
|
|
void
|
|
CoreInitDefaultHeap(MEMHeapHandle *outMem1,
|
|
MEMHeapHandle *outFG,
|
|
MEMHeapHandle *outMem2);
|
|
|
|
/**
|
|
* Allows the user to completely customise the default heaps, this runs after
|
|
* the rpx code section has loaded but before the data section as the data
|
|
* sections are allocated from the default heap.
|
|
*
|
|
* This is for a user to export from their .rpx file, it is not exported from
|
|
* coreinit.rpl
|
|
*/
|
|
void
|
|
__preinit_user(MEMHeapHandle *outMem1,
|
|
MEMHeapHandle *outFG,
|
|
MEMHeapHandle *outMem2);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
/** @} */
|