Minor formatting

This commit is contained in:
Maschell 2018-07-07 17:47:34 +02:00
parent ed90e19453
commit daaff292c1

View File

@ -31,11 +31,6 @@
#define MEMORY_ARENA_8 7 #define MEMORY_ARENA_8 7
#define MEMORY_ARENA_FG_BUCKET 8 #define MEMORY_ARENA_FG_BUCKET 8
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Memory functions
//! This is the only place where those are needed so lets keep them more or less private
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
static MEMHeapHandle mem1_heap = NULL; static MEMHeapHandle mem1_heap = NULL;
static MEMHeapHandle bucket_heap = NULL; static MEMHeapHandle bucket_heap = NULL;
@ -43,15 +38,17 @@ void memoryInitialize(void) {
MEMHeapHandle mem1_heap_handle = MEMGetBaseHeapHandle(MEMORY_ARENA_1); MEMHeapHandle mem1_heap_handle = MEMGetBaseHeapHandle(MEMORY_ARENA_1);
uint32_t mem1_allocatable_size = MEMGetAllocatableSizeForFrmHeapEx(mem1_heap_handle, 4); uint32_t mem1_allocatable_size = MEMGetAllocatableSizeForFrmHeapEx(mem1_heap_handle, 4);
void *mem1_memory = MEMAllocFromFrmHeapEx(mem1_heap_handle, mem1_allocatable_size, 4); void *mem1_memory = MEMAllocFromFrmHeapEx(mem1_heap_handle, mem1_allocatable_size, 4);
if(mem1_memory) if(mem1_memory){
mem1_heap = MEMCreateExpHeapEx(mem1_memory, mem1_allocatable_size, 0); mem1_heap = MEMCreateExpHeapEx(mem1_memory, mem1_allocatable_size, 0);
}
MEMHeapHandle bucket_heap_handle = MEMGetBaseHeapHandle(MEMORY_ARENA_FG_BUCKET); MEMHeapHandle bucket_heap_handle = MEMGetBaseHeapHandle(MEMORY_ARENA_FG_BUCKET);
uint32_t bucket_allocatable_size = MEMGetAllocatableSizeForFrmHeapEx(bucket_heap_handle, 4); uint32_t bucket_allocatable_size = MEMGetAllocatableSizeForFrmHeapEx(bucket_heap_handle, 4);
void *bucket_memory = MEMAllocFromFrmHeapEx(bucket_heap_handle, bucket_allocatable_size, 4); void *bucket_memory = MEMAllocFromFrmHeapEx(bucket_heap_handle, bucket_allocatable_size, 4);
if(bucket_memory) if(bucket_memory){
bucket_heap = MEMCreateExpHeapEx(bucket_memory, bucket_allocatable_size, 0); bucket_heap = MEMCreateExpHeapEx(bucket_memory, bucket_allocatable_size, 0);
} }
}
void memoryRelease(void) { void memoryRelease(void) {
MEMDestroyExpHeap(mem1_heap); MEMDestroyExpHeap(mem1_heap);
@ -75,8 +72,9 @@ void MEM2_free(void *ptr) {
} }
void * MEM1_alloc(uint32_t size, uint32_t align) { void * MEM1_alloc(uint32_t size, uint32_t align) {
if (align < 4) if (align < 4){
align = 4; align = 4;
}
return MEMAllocFromExpHeapEx(mem1_heap, size, align); return MEMAllocFromExpHeapEx(mem1_heap, size, align);
} }
@ -85,8 +83,9 @@ void MEM1_free(void *ptr) {
} }
void * MEMBucket_alloc(uint32_t size, uint32_t align) { void * MEMBucket_alloc(uint32_t size, uint32_t align) {
if (align < 4) if (align < 4){
align = 4; align = 4;
}
return MEMAllocFromExpHeapEx(bucket_heap, size, align); return MEMAllocFromExpHeapEx(bucket_heap, size, align);
} }