2018-11-29 19:24:28 +08:00
|
|
|
#ifndef GUARD_ALLOC_H
|
|
|
|
#define GUARD_ALLOC_H
|
2017-09-01 16:53:06 +02:00
|
|
|
|
2017-11-12 23:16:51 -05:00
|
|
|
#define HEAP_SIZE 0x1C000
|
2017-09-15 22:12:45 -04:00
|
|
|
|
2017-11-02 18:19:49 +01:00
|
|
|
#define FREE_AND_SET_NULL(ptr) \
|
|
|
|
{ \
|
2022-09-16 20:36:44 -03:00
|
|
|
Free(ptr); \
|
2017-11-02 18:19:49 +01:00
|
|
|
ptr = NULL; \
|
|
|
|
}
|
|
|
|
|
2021-01-19 04:03:51 -05:00
|
|
|
#define TRY_FREE_AND_SET_NULL(ptr) if (ptr != NULL) FREE_AND_SET_NULL(ptr)
|
|
|
|
|
2017-09-19 21:00:24 -04: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-15 22:12:45 -04:00
|
|
|
void InitHeap(void *pointer, u32 size);
|
2017-09-01 16:53:06 +02:00
|
|
|
|
2018-11-29 19:24:28 +08:00
|
|
|
#endif // GUARD_ALLOC_H
|