summaryrefslogtreecommitdiff
path: root/core/print_string.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-05-14 23:09:03 +0200
committerGitHub <noreply@github.com>2020-05-14 23:09:03 +0200
commit00949f0c5fcc6a4f8382a4a97d5591fd9ec380f8 (patch)
tree2b1c31f45add24085b64425ce440f577424c16a1 /core/print_string.cpp
parent5046f666a1181675b39f156c38346525dc1c444e (diff)
parent0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (diff)
Merge pull request #38738 from akien-mga/cause-we-never-go-out-of-style
Style: Remove new line at block start, enforce line between functions, enforce braces in if and loop blocks
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);
}