summaryrefslogtreecommitdiff
path: root/src/code/gamealloc.c
diff options
context:
space:
mode:
authorRoman971 <romanlasnier@hotmail.com>2020-03-22 22:19:43 +0100
committerRoman971 <romanlasnier@hotmail.com>2020-03-22 22:20:03 +0100
commit8cfe7cce9f8d8abea794e67510879e751d373a87 (patch)
treec6c46f34d3575f6dc02b98b2b5f5ad88d2b2c64e /src/code/gamealloc.c
parent251aea64ab3e6e8cd6f1d9ed34f514e656724777 (diff)
Format all src C files
Diffstat (limited to 'src/code/gamealloc.c')
-rw-r--r--src/code/gamealloc.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c
index 87a32db16..9ec6886b2 100644
--- a/src/code/gamealloc.c
+++ b/src/code/gamealloc.c
@@ -1,26 +1,22 @@
#include <global.h>
-void GameAlloc_Log(GameAlloc* this)
-{
+void GameAlloc_Log(GameAlloc* this) {
GameAllocEntry* iter;
osSyncPrintf("this = %08x\n", this);
iter = this->base.next;
- while (iter != &this->base)
- {
+ while (iter != &this->base) {
osSyncPrintf("ptr = %08x size = %d\n", iter, iter->size);
iter = iter->next;
}
}
-void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line)
-{
+void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line) {
GameAllocEntry* ptr;
- ptr = SystemArena_MallocDebug(size+sizeof(GameAllocEntry), file, line);
- if (ptr)
- {
+ ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), file, line);
+ if (ptr) {
ptr->size = size;
ptr->prev = this->head;
this->head->next = ptr;
@@ -28,18 +24,16 @@ void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 lin
ptr->next = &this->base;
this->base.prev = this->head;
return ptr + 1;
- }
- else
+ } else {
return NULL;
+ }
}
-void* GameAlloc_Malloc(GameAlloc* this, u32 size)
-{
+void* GameAlloc_Malloc(GameAlloc* this, u32 size) {
GameAllocEntry* ptr;
- ptr = SystemArena_MallocDebug(size+sizeof(GameAllocEntry), "../gamealloc.c", 93);
- if (ptr)
- {
+ ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), "../gamealloc.c", 93);
+ if (ptr) {
ptr->size = size;
ptr->prev = this->head;
this->head->next = ptr;
@@ -47,17 +41,15 @@ void* GameAlloc_Malloc(GameAlloc* this, u32 size)
ptr->next = &this->base;
this->base.prev = this->head;
return ptr + 1;
- }
- else
+ } else {
return NULL;
+ }
}
-void GameAlloc_Free(GameAlloc* this, void* data)
-{
+void GameAlloc_Free(GameAlloc* this, void* data) {
GameAllocEntry* ptr;
- if (data)
- {
+ if (data) {
ptr = &((GameAllocEntry*)data)[-1];
LogUtils_CheckNullPointer("ptr->prev", ptr->prev, "../gamealloc.c", 120);
LogUtils_CheckNullPointer("ptr->next", ptr->next, "../gamealloc.c", 121);
@@ -68,14 +60,12 @@ void GameAlloc_Free(GameAlloc* this, void* data)
}
}
-void GameAlloc_Cleanup(GameAlloc* this)
-{
+void GameAlloc_Cleanup(GameAlloc* this) {
GameAllocEntry* next;
GameAllocEntry* cur;
next = this->base.next;
- while (&this->base != next)
- {
+ while (&this->base != next) {
cur = next;
next = next->next;
SystemArena_FreeDebug(cur, "../gamealloc.c", 145);
@@ -84,11 +74,9 @@ void GameAlloc_Cleanup(GameAlloc* this)
this->head = &this->base;
this->base.next = &this->base;
this->base.prev = &this->base;
-
}
-void GameAlloc_Init(GameAlloc* this)
-{
+void GameAlloc_Init(GameAlloc* this) {
this->head = &this->base;
this->base.next = &this->base;
this->base.prev = &this->base;