summaryrefslogtreecommitdiff
path: root/core/print_string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/print_string.cpp')
-rw-r--r--core/print_string.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/core/print_string.cpp b/core/print_string.cpp
index 8eb1d9e86a..54de229471 100644
--- a/core/print_string.cpp
+++ b/core/print_string.cpp
@@ -39,7 +39,6 @@ bool _print_line_enabled = true;
bool _print_error_enabled = true;
void add_print_handler(PrintHandlerList *p_handler) {
-
_global_lock();
p_handler->next = print_handler_list;
print_handler_list = p_handler;
@@ -47,20 +46,18 @@ void add_print_handler(PrintHandlerList *p_handler) {
}
void remove_print_handler(PrintHandlerList *p_handler) {
-
_global_lock();
PrintHandlerList *prev = nullptr;
PrintHandlerList *l = print_handler_list;
while (l) {
-
if (l == p_handler) {
-
- if (prev)
+ if (prev) {
prev->next = l->next;
- else
+ } else {
print_handler_list = l->next;
+ }
break;
}
prev = l;
@@ -73,16 +70,15 @@ void remove_print_handler(PrintHandlerList *p_handler) {
}
void print_line(String p_string) {
-
- if (!_print_line_enabled)
+ if (!_print_line_enabled) {
return;
+ }
OS::get_singleton()->print("%s\n", p_string.utf8().get_data());
_global_lock();
PrintHandlerList *l = print_handler_list;
while (l) {
-
l->printfunc(l->userdata, p_string, false);
l = l->next;
}
@@ -91,16 +87,15 @@ void print_line(String p_string) {
}
void print_error(String p_string) {
-
- if (!_print_error_enabled)
+ if (!_print_error_enabled) {
return;
+ }
OS::get_singleton()->printerr("%s\n", p_string.utf8().get_data());
_global_lock();
PrintHandlerList *l = print_handler_list;
while (l) {
-
l->printfunc(l->userdata, p_string, true);
l = l->next;
}
@@ -109,7 +104,6 @@ void print_error(String p_string) {
}
void print_verbose(String p_string) {
-
if (OS::get_singleton()->is_stdout_verbose()) {
print_line(p_string);
}