diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 16:44:50 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 16:44:50 +0100 |
commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /core/error_macros.cpp | |
parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
download | redot-engine-5dbf1809c6e3e905b94b8764e99491e608122261.tar.gz |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'core/error_macros.cpp')
-rw-r--r-- | core/error_macros.cpp | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/core/error_macros.cpp b/core/error_macros.cpp index e963f6122b..530e209dd8 100644 --- a/core/error_macros.cpp +++ b/core/error_macros.cpp @@ -30,12 +30,11 @@ #include "os/os.h" +bool _err_error_exists = false; -bool _err_error_exists=false; +static ErrorHandlerList *error_handler_list = NULL; -static ErrorHandlerList *error_handler_list=NULL; - -void _err_set_last_error(const char* p_err) { +void _err_set_last_error(const char *p_err) { OS::get_singleton()->set_last_error(p_err); } @@ -48,8 +47,8 @@ void _err_clear_last_error() { void add_error_handler(ErrorHandlerList *p_handler) { _global_lock(); - p_handler->next=error_handler_list; - error_handler_list=p_handler; + p_handler->next = error_handler_list; + error_handler_list = p_handler; _global_unlock(); } @@ -60,44 +59,39 @@ void remove_error_handler(ErrorHandlerList *p_handler) { ErrorHandlerList *prev = NULL; ErrorHandlerList *l = error_handler_list; - while(l) { + while (l) { - if (l==p_handler) { + if (l == p_handler) { if (prev) - prev->next=l->next; + prev->next = l->next; else - error_handler_list=l->next; + error_handler_list = l->next; break; } - prev=l; - l=l->next; - + prev = l; + l = l->next; } _global_unlock(); - } -void _err_print_error(const char* p_function, const char* p_file,int p_line,const char *p_error,ErrorHandlerType p_type) { +void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, ErrorHandlerType p_type) { - - - OS::get_singleton()->print_error(p_function,p_file,p_line,p_error,_err_error_exists?OS::get_singleton()->get_last_error():"",(OS::ErrorType)p_type); + OS::get_singleton()->print_error(p_function, p_file, p_line, p_error, _err_error_exists ? OS::get_singleton()->get_last_error() : "", (OS::ErrorType)p_type); _global_lock(); ErrorHandlerList *l = error_handler_list; - while(l) { + while (l) { - l->errfunc(l->userdata,p_function,p_file,p_line,p_error,_err_error_exists?OS::get_singleton()->get_last_error():"",p_type); - l=l->next; + l->errfunc(l->userdata, p_function, p_file, p_line, p_error, _err_error_exists ? OS::get_singleton()->get_last_error() : "", p_type); + l = l->next; } _global_unlock(); if (_err_error_exists) { OS::get_singleton()->clear_last_error(); - _err_error_exists=false; + _err_error_exists = false; } - } |