From a5df9dddf06adc328dea2877d1f21d1836653b35 Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Wed, 6 Jul 2022 01:29:34 +0200 Subject: Use Macro for __FILE__ & __LINE__ when possible (#559) * First batch some overlay * Almost all overlay * effect & gamestate * kaleido stuffs * more overlay * more left over from code folder * remaining hardcoded line and file * Open & Close _DISP __FILE__ & __LINE__ clean up * Some if (1) {} remove * LOG_xxxx __FILE__ , __LINE__ cleaned * ASSERT macro __FILE__ __LINE__ * mtx without line/file in functions * " if (1) {} " & "if (0) {}" and tab/white place * LogUtils as macro * GameState_, GameAlloc_, SystemArena_ & ZeldaArena_ * Revert "GameState_, GameAlloc_, SystemArena_ & ZeldaArena_" This reverts commit 0d85caaf7e342648c01a15fe21e93637352dc596. * Like last commit but as macro * Fix matrix not using macros * use function not macro * DebugArena_* functions GameAlloc_MallocDebug BgCheck_PosErrorCheck as macros removed issues with ; in macro file --- soh/src/code/gamealloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'soh/src/code/gamealloc.c') diff --git a/soh/src/code/gamealloc.c b/soh/src/code/gamealloc.c index 451c56de2..105fe0520 100644 --- a/soh/src/code/gamealloc.c +++ b/soh/src/code/gamealloc.c @@ -13,7 +13,7 @@ void GameAlloc_Log(GameAlloc* this) { } void* GameAlloc_MallocDebug(GameAlloc* this, size_t size, const char* file, s32 line) { - GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), file, line); + GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), __FILE__, __LINE__); if (ptr != NULL) { ptr->size = size; @@ -29,7 +29,7 @@ void* GameAlloc_MallocDebug(GameAlloc* this, size_t size, const char* file, s32 } void* GameAlloc_Malloc(GameAlloc* this, size_t size) { - GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), "../gamealloc.c", 93); + GameAllocEntry* ptr = SYSTEM_ARENA_MALLOC_DEBUG(size + sizeof(GameAllocEntry)); if (ptr != NULL) { ptr->size = size; @@ -49,12 +49,12 @@ void GameAlloc_Free(GameAlloc* this, void* data) { if (data != NULL) { ptr = &((GameAllocEntry*)data)[-1]; - LogUtils_CheckNullPointer("ptr->prev", ptr->prev, "../gamealloc.c", 120); - LogUtils_CheckNullPointer("ptr->next", ptr->next, "../gamealloc.c", 121); + LOG_CHECK_NULL_POINTER("ptr->prev", ptr->prev); + LOG_CHECK_NULL_POINTER("ptr->next", ptr->next); ptr->prev->next = ptr->next; ptr->next->prev = ptr->prev; this->head = this->base.prev; - SystemArena_FreeDebug(ptr, "../gamealloc.c", 125); + SYSTEM_ARENA_FREE_DEBUG(ptr); } } @@ -65,7 +65,7 @@ void GameAlloc_Cleanup(GameAlloc* this) { while (&this->base != next) { cur = next; next = next->next; - SystemArena_FreeDebug(cur, "../gamealloc.c", 145); + SYSTEM_ARENA_FREE_DEBUG(cur); } this->head = &this->base; -- cgit v1.2.3