2018-11-29 11:24:28 +00:00
|
|
|
#ifndef GUARD_ALLOC_H
|
|
|
|
#define GUARD_ALLOC_H
|
2017-09-01 15:53:06 +01:00
|
|
|
|
2017-11-13 04:16:51 +00:00
|
|
|
#define HEAP_SIZE 0x1C000
|
2017-09-16 03:12:45 +01:00
|
|
|
|
2017-11-02 17:19:49 +00:00
|
|
|
#define FREE_AND_SET_NULL(ptr) \
|
|
|
|
{ \
|
2022-09-17 00:36:44 +01:00
|
|
|
Free(ptr); \
|
2017-11-02 17:19:49 +00:00
|
|
|
ptr = NULL; \
|
|
|
|
}
|
|
|
|
|
2021-01-19 09:03:51 +00:00
|
|
|
#define TRY_FREE_AND_SET_NULL(ptr) if (ptr != NULL) FREE_AND_SET_NULL(ptr)
|
|
|
|
|
2017-09-20 02:00:24 +01:00
|
|
|
extern u8 gHeap[];
|
2018-10-14 19:00:14 +01:00
|
|
|
|
2017-09-01 15:53:06 +01:00
|
|
|
void *Alloc(u32 size);
|
|
|
|
void *AllocZeroed(u32 size);
|
|
|
|
void Free(void *pointer);
|
2017-09-16 03:12:45 +01:00
|
|
|
void InitHeap(void *pointer, u32 size);
|
2017-09-01 15:53:06 +01:00
|
|
|
|
2018-11-29 11:24:28 +00:00
|
|
|
#endif // GUARD_ALLOC_H
|