diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2023-05-08 13:52:51 +0200 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-05-08 13:52:51 +0200 |
| commit | 491a437df51192f76ac19cee1ba2001365697cc4 (patch) | |
| tree | ada1019b3c7351a5ca6daf38273490a6a145a79c /core/string | |
| parent | c9f81045be9760820a1bb4898f08d2ff9784d4b7 (diff) | |
| parent | 273a6eeb66ed1ff2fcc1ee3a6eaae4eedf437875 (diff) | |
| download | redot-engine-491a437df51192f76ac19cee1ba2001365697cc4.tar.gz | |
Merge pull request #76540 from reduz/redo-remote-filesystem
Redo how the remote filesystem works
Diffstat (limited to 'core/string')
| -rw-r--r-- | core/string/print_string.cpp | 6 | ||||
| -rw-r--r-- | core/string/print_string.h | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/core/string/print_string.cpp b/core/string/print_string.cpp index 7b894d83bf..7b90710308 100644 --- a/core/string/print_string.cpp +++ b/core/string/print_string.cpp @@ -193,10 +193,8 @@ void print_error(String p_string) { _global_unlock(); } -void print_verbose(String p_string) { - if (OS::get_singleton()->is_stdout_verbose()) { - print_line(p_string); - } +bool is_print_verbose_enabled() { + return OS::get_singleton()->is_stdout_verbose(); } String stringify_variants(Variant p_var) { diff --git a/core/string/print_string.h b/core/string/print_string.h index 6496384b3f..7656e9bfa1 100644 --- a/core/string/print_string.h +++ b/core/string/print_string.h @@ -59,7 +59,15 @@ void remove_print_handler(const PrintHandlerList *p_handler); extern void __print_line(String p_string); extern void __print_line_rich(String p_string); extern void print_error(String p_string); -extern void print_verbose(String p_string); +extern bool is_print_verbose_enabled(); + +// This version avoids processing the text to be printed until it actually has to be printed, saving some CPU usage. +#define print_verbose(m_text) \ + { \ + if (is_print_verbose_enabled()) { \ + print_line(m_text); \ + } \ + } inline void print_line(Variant v) { __print_line(stringify_variants(v)); |
