summaryrefslogtreecommitdiff
path: root/src/code/debug_malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/code/debug_malloc.c')
-rw-r--r--src/code/debug_malloc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c
index a1def050a..b6aa81b32 100644
--- a/src/code/debug_malloc.c
+++ b/src/code/debug_malloc.c
@@ -7,14 +7,16 @@
Arena sDebugArena;
-#if OOT_DEBUG
+#if DEBUG_FEATURES
s32 gDebugArenaLogSeverity = LOG_SEVERITY_ERROR;
void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) {
if (ptr == NULL) {
if (gDebugArenaLogSeverity >= LOG_SEVERITY_ERROR) {
PRINTF(T("%s: %u バイトの%sに失敗しました\n", "%s: %u bytes %s failed\n"), name, size, action);
+#if PLATFORM_GC
__osDisplayArena(&sDebugArena);
+#endif
return;
}
} else if (gDebugArenaLogSeverity >= LOG_SEVERITY_VERBOSE) {
@@ -34,7 +36,7 @@ void* DebugArena_Malloc(u32 size) {
return ptr;
}
-#if OOT_DEBUG
+#if DEBUG_FEATURES
void* DebugArena_MallocDebug(u32 size, const char* file, int line) {
void* ptr = __osMallocDebug(&sDebugArena, size, file, line);
@@ -50,7 +52,7 @@ void* DebugArena_MallocR(u32 size) {
return ptr;
}
-#if OOT_DEBUG
+#if DEBUG_FEATURES
void* DebugArena_MallocRDebug(u32 size, const char* file, int line) {
void* ptr = __osMallocRDebug(&sDebugArena, size, file, line);
@@ -65,7 +67,7 @@ void* DebugArena_Realloc(void* ptr, u32 newSize) {
return ptr;
}
-#if OOT_DEBUG
+#if DEBUG_FEATURES
void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) {
ptr = __osReallocDebug(&sDebugArena, ptr, newSize, file, line);
DEBUG_ARENA_CHECK_POINTER(ptr, newSize, "debug_realloc_DEBUG", "再確保"); // "Re-securing"
@@ -77,7 +79,7 @@ void DebugArena_Free(void* ptr) {
__osFree(&sDebugArena, ptr);
}
-#if OOT_DEBUG
+#if DEBUG_FEATURES
void DebugArena_FreeDebug(void* ptr, const char* file, int line) {
__osFreeDebug(&sDebugArena, ptr, file, line);
}
@@ -96,7 +98,7 @@ void* DebugArena_Calloc(u32 num, u32 size) {
return ret;
}
-#if OOT_DEBUG
+#if PLATFORM_GC && DEBUG_FEATURES
void DebugArena_Display(void) {
// Likely copypasted from ZeldaArena_Display, should say "Debug"
PRINTF(T("ゼルダヒープ表示\n", "Zelda heap display\n"));
@@ -113,14 +115,14 @@ void DebugArena_Check(void) {
}
void DebugArena_Init(void* start, u32 size) {
-#if OOT_DEBUG
+#if DEBUG_FEATURES
gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG;
#endif
__osMallocInit(&sDebugArena, start, size);
}
void DebugArena_Cleanup(void) {
-#if OOT_DEBUG
+#if DEBUG_FEATURES
gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG;
#endif
__osMallocCleanup(&sDebugArena);