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