pokeemerald/gflib/malloc.h

22 lines
491 B
C
Raw Normal View History

#ifndef GUARD_ALLOC_H
#define GUARD_ALLOC_H
2017-09-01 14:53:06 +00:00
2017-09-16 02:12:45 +00:00
2017-11-02 17:19:49 +00:00
#define FREE_AND_SET_NULL(ptr) \
{ \
2022-09-16 23:36:44 +00: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)
2023-11-12 02:19:50 +00:00
#define HEAP_SIZE 0x1C000
2023-11-23 21:13:50 +00:00
extern u8 gHeap[HEAP_SIZE];
2017-09-01 14:53:06 +00:00
void *Alloc(u32 size);
void *AllocZeroed(u32 size);
void Free(void *pointer);
2017-09-16 02:12:45 +00:00
void InitHeap(void *pointer, u32 size);
2017-09-01 14:53:06 +00:00
#endif // GUARD_ALLOC_H