summaryrefslogtreecommitdiff
path: root/src/code/z_malloc.c
diff options
context:
space:
mode:
authorfig02 <fig02srl@gmail.com>2024-11-17 17:02:07 -0500
committerGitHub <noreply@github.com>2024-11-17 17:02:07 -0500
commit17edb82c0d22fb78135033f92a624bd6cde6f495 (patch)
tree1f5f077c12e3a693745fcbb0aa450b35cf8ff9b6 /src/code/z_malloc.c
parentcf4dc98cc934cdb62ed8b5001602468fac6dfeb3 (diff)
Decouple Debug Features From gc-eu-mq-dbg (#2296)
* rename OOT_DEBUG to DEBUG_FEATURES * makefile changes * add DEBUG_ASSETS * fix DEBUG_FEATURES usages * format * fix errors * review * fix problem and review2 * review * add DEBUG_FEATURES to DEBUG_ASSETS check * review * whoops * format
Diffstat (limited to 'src/code/z_malloc.c')
-rw-r--r--src/code/z_malloc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c
index 901e7b4e7..eaa1408bf 100644
--- a/src/code/z_malloc.c
+++ b/src/code/z_malloc.c
@@ -7,14 +7,16 @@
Arena sZeldaArena;
-#if OOT_DEBUG
+#if DEBUG_FEATURES
s32 gZeldaArenaLogSeverity = LOG_SEVERITY_ERROR;
void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) {
if (ptr == NULL) {
if (gZeldaArenaLogSeverity >= LOG_SEVERITY_ERROR) {
PRINTF(T("%s: %u バイトの%sに失敗しました\n", "%s: %u bytes %s failed\n"), name, size, action);
+#if PLATFORM_GC
__osDisplayArena(&sZeldaArena);
+#endif
}
} else if (gZeldaArenaLogSeverity >= LOG_SEVERITY_VERBOSE) {
PRINTF(T("%s: %u バイトの%sに成功しました\n", "%s: %u bytes %s succeeded\n"), name, size, action);
@@ -34,7 +36,7 @@ void* ZeldaArena_Malloc(u32 size) {
return ptr;
}
-#if OOT_DEBUG
+#if DEBUG_FEATURES
void* ZeldaArena_MallocDebug(u32 size, const char* file, int line) {
void* ptr = __osMallocDebug(&sZeldaArena, size, file, line);
@@ -50,7 +52,7 @@ void* ZeldaArena_MallocR(u32 size) {
return ptr;
}
-#if OOT_DEBUG
+#if DEBUG_FEATURES
void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line) {
void* ptr = __osMallocRDebug(&sZeldaArena, size, file, line);
@@ -65,7 +67,7 @@ void* ZeldaArena_Realloc(void* ptr, u32 newSize) {
return ptr;
}
-#if OOT_DEBUG
+#if DEBUG_FEATURES
void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) {
ptr = __osReallocDebug(&sZeldaArena, ptr, newSize, file, line);
ZELDA_ARENA_CHECK_POINTER(ptr, newSize, "zelda_realloc_DEBUG", T("再確保", "Re-securing"));
@@ -77,7 +79,7 @@ void ZeldaArena_Free(void* ptr) {
__osFree(&sZeldaArena, ptr);
}
-#if OOT_DEBUG
+#if DEBUG_FEATURES
void ZeldaArena_FreeDebug(void* ptr, const char* file, int line) {
__osFreeDebug(&sZeldaArena, ptr, file, line);
}
@@ -96,7 +98,7 @@ void* ZeldaArena_Calloc(u32 num, u32 size) {
return ret;
}
-#if OOT_DEBUG
+#if PLATFORM_GC && DEBUG_FEATURES
void ZeldaArena_Display(void) {
PRINTF(T("ゼルダヒープ表示\n", "Zelda heap display\n"));
__osDisplayArena(&sZeldaArena);
@@ -112,14 +114,14 @@ void ZeldaArena_Check(void) {
}
void ZeldaArena_Init(void* start, u32 size) {
-#if OOT_DEBUG
+#if DEBUG_FEATURES
gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG;
#endif
__osMallocInit(&sZeldaArena, start, size);
}
void ZeldaArena_Cleanup(void) {
-#if OOT_DEBUG
+#if DEBUG_FEATURES
gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG;
#endif
__osMallocCleanup(&sZeldaArena);