From 689be3b6b06bf508c27a14a1f09bd3183906a87b Mon Sep 17 00:00:00 2001 From: red031000 Date: Thu, 5 Oct 2023 00:52:18 +0100 Subject: [PATCH] cleanup error handling --- include/assert.h | 11 ++--------- include/error_handling.h | 9 ++++++++- src/error_handling.c | 3 ++- src/heap.c | 1 + 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/assert.h b/include/assert.h index 522a56b35..3c7850894 100644 --- a/include/assert.h +++ b/include/assert.h @@ -1,6 +1,8 @@ #ifndef POKEHEARTGOLD_ASSERT_H #define POKEHEARTGOLD_ASSERT_H +#include "error_handling.h" + /* * Assert statements. If the expression evaluates false, * the software will terminate. @@ -13,13 +15,4 @@ #define GF_ASSERT(...) ((void)0) #endif //PM_KEEP_ASSERTS -/* - * void GF_AssertFail(void) - * - * Called when an assertion fails. - * Do not use this directly. - * Instead, use the GF_ASSERT macro defined above. - */ -void GF_AssertFail(void); - #endif //POKEHEARTGOLD_ASSERT_H diff --git a/include/error_handling.h b/include/error_handling.h index 8996e6f69..ef5991a9f 100644 --- a/include/error_handling.h +++ b/include/error_handling.h @@ -1,6 +1,13 @@ #ifndef POKEHEARTGOLD_ERROR_HANDLING_H #define POKEHEARTGOLD_ERROR_HANDLING_H -void PrintErrorMessageAndReset(void); +/* + * void GF_AssertFail(void) + * + * Called when an assertion fails. + * Do not use this directly. + * Instead, use the GF_ASSERT macro defined above. + */ +void GF_AssertFail(void); #endif //POKEHEARTGOLD_ERROR_HANDLING_H diff --git a/src/error_handling.c b/src/error_handling.c index b514cc89d..d379836e3 100644 --- a/src/error_handling.c +++ b/src/error_handling.c @@ -1,6 +1,7 @@ #include "global.h" -#include "unk_02037C94.h" #include "error_handling.h" +#include "error_message_reset.h" +#include "unk_02037C94.h" void GF_AssertFail(void) { if (!sub_02037D78()) { diff --git a/src/heap.c b/src/heap.c index aa0568553..531d12798 100644 --- a/src/heap.c +++ b/src/heap.c @@ -2,6 +2,7 @@ #include "heap.h" #include "unk_02037C94.h" #include "error_handling.h" +#include "error_message_reset.h" struct HeapInfo { NNSFndHeapHandle *heapHandles;