Use enums instead of defines in memheap.h

This commit is contained in:
James Benton 2016-07-23 11:08:00 +01:00
parent 29b6d586e6
commit d02bdf6e35
3 changed files with 19 additions and 14 deletions

View File

@ -14,8 +14,9 @@ extern "C" {
typedef enum MEMFrameHeapFreeMode
{
MEM_FRAME_HEAP_FREE_FROM_BOTTOM = 1 << 0,
MEM_FRAME_HEAP_FREE_FROM_TOP = 1 << 1,
MEM_FRAME_HEAP_FREE_HEAD = 1 << 0,
MEM_FRAME_HEAP_FREE_TAIL = 1 << 1,
MEM_FRAME_HEAP_FREE_ALL = MEM_FRAME_HEAP_FREE_HEAD | MEM_FRAME_HEAP_FREE_TAIL,
} MEMFrameHeapFreeMode;
typedef struct MEMFrameHeap MEMFrameHeap;
@ -48,7 +49,7 @@ CHECK_OFFSET(MEMFrameHeap, 0x48, previousState);
CHECK_SIZE(MEMFrameHeap, 0x4C);
MEMFrameHeap *
MEMCreateFrmHeapEx(MEMFrameHeap *heap,
MEMCreateFrmHeapEx(void *heap,
uint32_t size,
uint32_t flags);

View File

@ -24,21 +24,26 @@ typedef enum MEMHeapFillType
MEM_HEAP_FILL_TYPE_FREED = 2,
} MEMHeapFillType;
#define MEM_BLOCK_HEAP_TAG 0x424C4B48u
#define MEM_EXPANDED_HEAP_TAG 0x45585048u
#define MEM_FRAME_HEAP_TAG 0x46524D48u
#define MEM_UNIT_HEAP_TAG 0x554E5448u
#define MEM_USER_HEAP_TAG 0x55535248u
typedef enum MEMHeapTag
{
MEM_BLOCK_HEAP_TAG = 0x424C4B48u,
MEM_EXPANDED_HEAP_TAG = 0x45585048u,
MEM_FRAME_HEAP_TAG = 0x46524D48u,
MEM_UNIT_HEAP_TAG = 0x554E5448u,
MEM_USER_HEAP_TAG = 0x55535248u,
} MEMHeapTag;
#define MEM_HEAP_FLAG_ZERO_ALLOCATED (1 << 0)
#define MEM_HEAP_FLAG_DEBUG_MODE (1 << 1)
#define MEM_HEAP_FLAG_USE_LOCK (1 << 2)
typedef enum MEMHeapFlags
{
MEM_HEAP_FLAG_ZERO_ALLOCATED = 1 << 0,
MEM_HEAP_FLAG_DEBUG_MODE = 1 << 1,
MEM_HEAP_FLAG_USE_LOCK = 1 << 2,
} MEMHeapFlags;
struct MEMHeapHeader
{
//! Tag indicating which type of heap this is
uint32_t tag;
MEMHeapTag tag;
//! Link for list this heap is in
MEMMemoryLink link;

View File

@ -19,7 +19,6 @@ struct MEMMemoryLink
void *prev;
void *next;
};
CHECK_OFFSET(MEMMemoryLink, 0x0, prev);
CHECK_OFFSET(MEMMemoryLink, 0x4, next);
CHECK_SIZE(MEMMemoryLink, 0x8);