summaryrefslogtreecommitdiffstats
path: root/core/error_macros.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/error_macros.cpp')
-rw-r--r--core/error_macros.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/core/error_macros.cpp b/core/error_macros.cpp
index f6da990562..2fae939965 100644
--- a/core/error_macros.cpp
+++ b/core/error_macros.cpp
@@ -34,10 +34,9 @@
#include "core/ustring.h"
#include "os/os.h"
-static ErrorHandlerList *error_handler_list = NULL;
+static ErrorHandlerList *error_handler_list = nullptr;
void add_error_handler(ErrorHandlerList *p_handler) {
-
_global_lock();
p_handler->next = error_handler_list;
error_handler_list = p_handler;
@@ -45,20 +44,18 @@ void add_error_handler(ErrorHandlerList *p_handler) {
}
void remove_error_handler(ErrorHandlerList *p_handler) {
-
_global_lock();
- ErrorHandlerList *prev = NULL;
+ ErrorHandlerList *prev = nullptr;
ErrorHandlerList *l = error_handler_list;
while (l) {
-
if (l == p_handler) {
-
- if (prev)
+ if (prev) {
prev->next = l->next;
- else
+ } else {
error_handler_list = l->next;
+ }
break;
}
prev = l;
@@ -77,13 +74,11 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
}
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_message, ErrorHandlerType p_type) {
-
OS::get_singleton()->print_error(p_function, p_file, p_line, p_error, p_message, (Logger::ErrorType)p_type);
_global_lock();
ErrorHandlerList *l = error_handler_list;
while (l) {
-
l->errfunc(l->userdata, p_function, p_file, p_line, p_error, p_message, p_type);
l = l->next;
}
@@ -104,7 +99,6 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
}
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const char *p_message, bool fatal) {
-
String fstr(fatal ? "FATAL: " : "");
String err(fstr + "Index " + p_index_str + " = " + itos(p_index) + " is out of bounds (" + p_size_str + " = " + itos(p_size) + ").");
_err_print_error(p_function, p_file, p_line, err.utf8().get_data(), p_message);