diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-03-02 15:25:13 -0800 |
---|---|---|
committer | atrnati <54334261+atrnati@users.noreply.github.com> | 2020-03-03 08:51:32 -0600 |
commit | 876d4150aa3da531ddd687b48afada6e43f79146 (patch) | |
tree | fd72a71419f4cd800d4e500cfcaded4dfc8dc367 /host/lib/error_c.cpp | |
parent | 1393553d623bdf4ba40d5435c9719b6ce990d9ac (diff) | |
download | uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.gz uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.bz2 uhd-876d4150aa3da531ddd687b48afada6e43f79146.zip |
uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
Diffstat (limited to 'host/lib/error_c.cpp')
-rw-r--r-- | host/lib/error_c.cpp | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/host/lib/error_c.cpp b/host/lib/error_c.cpp index 0012ffb2c..0914ca4e7 100644 --- a/host/lib/error_c.cpp +++ b/host/lib/error_c.cpp @@ -8,28 +8,28 @@ #include <uhd/error.h> #include <uhd/exception.hpp> #include <uhd/utils/static.hpp> - #include <boost/thread/mutex.hpp> - #include <cstring> -#define MAP_TO_ERROR(exception_type, error_type) \ - if (dynamic_cast<const uhd::exception_type*>(e)) return error_type; +#define MAP_TO_ERROR(exception_type, error_type) \ + if (dynamic_cast<const uhd::exception_type*>(e)) \ + return error_type; -uhd_error error_from_uhd_exception(const uhd::exception* e){ - MAP_TO_ERROR(index_error, UHD_ERROR_INDEX) - MAP_TO_ERROR(key_error, UHD_ERROR_KEY) +uhd_error error_from_uhd_exception(const uhd::exception* e) +{ + MAP_TO_ERROR(index_error, UHD_ERROR_INDEX) + MAP_TO_ERROR(key_error, UHD_ERROR_KEY) MAP_TO_ERROR(not_implemented_error, UHD_ERROR_NOT_IMPLEMENTED) - MAP_TO_ERROR(usb_error, UHD_ERROR_USB) - MAP_TO_ERROR(io_error, UHD_ERROR_IO) - MAP_TO_ERROR(os_error, UHD_ERROR_OS) - MAP_TO_ERROR(assertion_error, UHD_ERROR_ASSERTION) - MAP_TO_ERROR(lookup_error, UHD_ERROR_LOOKUP) - MAP_TO_ERROR(type_error, UHD_ERROR_TYPE) - MAP_TO_ERROR(value_error, UHD_ERROR_VALUE) - MAP_TO_ERROR(runtime_error, UHD_ERROR_RUNTIME) - MAP_TO_ERROR(environment_error, UHD_ERROR_ENVIRONMENT) - MAP_TO_ERROR(system_error, UHD_ERROR_SYSTEM) + MAP_TO_ERROR(usb_error, UHD_ERROR_USB) + MAP_TO_ERROR(io_error, UHD_ERROR_IO) + MAP_TO_ERROR(os_error, UHD_ERROR_OS) + MAP_TO_ERROR(assertion_error, UHD_ERROR_ASSERTION) + MAP_TO_ERROR(lookup_error, UHD_ERROR_LOOKUP) + MAP_TO_ERROR(type_error, UHD_ERROR_TYPE) + MAP_TO_ERROR(value_error, UHD_ERROR_VALUE) + MAP_TO_ERROR(runtime_error, UHD_ERROR_RUNTIME) + MAP_TO_ERROR(environment_error, UHD_ERROR_ENVIRONMENT) + MAP_TO_ERROR(system_error, UHD_ERROR_SYSTEM) return UHD_ERROR_EXCEPT; } @@ -42,28 +42,25 @@ UHD_SINGLETON_FCN(std::string, _c_global_error_string) static boost::mutex _error_c_mutex; -std::string get_c_global_error_string(){ +std::string get_c_global_error_string() +{ boost::mutex::scoped_lock lock(_error_c_mutex); return _c_global_error_string(); } -void set_c_global_error_string( - const std::string &msg -){ +void set_c_global_error_string(const std::string& msg) +{ boost::mutex::scoped_lock lock(_error_c_mutex); _c_global_error_string() = msg; } -uhd_error uhd_get_last_error( - char* error_out, - size_t strbuffer_len -){ - try{ +uhd_error uhd_get_last_error(char* error_out, size_t strbuffer_len) +{ + try { auto error_str = get_c_global_error_string(); memset(error_out, '\0', strbuffer_len); strncpy(error_out, error_str.c_str(), strbuffer_len); - } - catch(...){ + } catch (...) { return UHD_ERROR_UNKNOWN; } return UHD_ERROR_NONE; |