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/usrp/subdev_spec_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/usrp/subdev_spec_c.cpp')
-rw-r--r-- | host/lib/usrp/subdev_spec_c.cpp | 152 |
1 files changed, 56 insertions, 96 deletions
diff --git a/host/lib/usrp/subdev_spec_c.cpp b/host/lib/usrp/subdev_spec_c.cpp index 8142256ac..b002d6d43 100644 --- a/host/lib/usrp/subdev_spec_c.cpp +++ b/host/lib/usrp/subdev_spec_c.cpp @@ -6,134 +6,94 @@ // #include <uhd/usrp/subdev_spec.h> - #include <string.h> -uhd_error uhd_subdev_spec_pair_free( - uhd_subdev_spec_pair_t *subdev_spec_pair -){ - UHD_SAFE_C( - if(subdev_spec_pair->db_name){ - free(subdev_spec_pair->db_name); - subdev_spec_pair->db_name = NULL; - } - if(subdev_spec_pair->sd_name){ - free(subdev_spec_pair->sd_name); - subdev_spec_pair->sd_name = NULL; - } - ) +uhd_error uhd_subdev_spec_pair_free(uhd_subdev_spec_pair_t* subdev_spec_pair) +{ + UHD_SAFE_C(if (subdev_spec_pair->db_name) { + free(subdev_spec_pair->db_name); + subdev_spec_pair->db_name = NULL; + } if (subdev_spec_pair->sd_name) { + free(subdev_spec_pair->sd_name); + subdev_spec_pair->sd_name = NULL; + }) } -uhd_error uhd_subdev_spec_pairs_equal( - const uhd_subdev_spec_pair_t* first, +uhd_error uhd_subdev_spec_pairs_equal(const uhd_subdev_spec_pair_t* first, const uhd_subdev_spec_pair_t* second, - bool *result_out -){ - UHD_SAFE_C( - *result_out = (uhd_subdev_spec_pair_c_to_cpp(first) == - uhd_subdev_spec_pair_c_to_cpp(second)); - ) + bool* result_out) +{ + UHD_SAFE_C(*result_out = (uhd_subdev_spec_pair_c_to_cpp(first) + == uhd_subdev_spec_pair_c_to_cpp(second));) } -uhd_error uhd_subdev_spec_make( - uhd_subdev_spec_handle* h, - const char* markup -){ - UHD_SAFE_C( - (*h) = new uhd_subdev_spec_t; - std::string markup_cpp(markup); - if(!markup_cpp.empty()){ - (*h)->subdev_spec_cpp = uhd::usrp::subdev_spec_t(markup_cpp); - } - ) +uhd_error uhd_subdev_spec_make(uhd_subdev_spec_handle* h, const char* markup) +{ + UHD_SAFE_C((*h) = new uhd_subdev_spec_t; std::string markup_cpp(markup); + if (!markup_cpp.empty()) { + (*h)->subdev_spec_cpp = uhd::usrp::subdev_spec_t(markup_cpp); + }) } -uhd_error uhd_subdev_spec_free( - uhd_subdev_spec_handle* h -){ - UHD_SAFE_C( - delete (*h); - (*h) = NULL; - ) +uhd_error uhd_subdev_spec_free(uhd_subdev_spec_handle* h) +{ + UHD_SAFE_C(delete (*h); (*h) = NULL;) } -uhd_error uhd_subdev_spec_size( - uhd_subdev_spec_handle h, - size_t *size_out -){ - UHD_SAFE_C_SAVE_ERROR(h, - *size_out = h->subdev_spec_cpp.size(); - ) +uhd_error uhd_subdev_spec_size(uhd_subdev_spec_handle h, size_t* size_out) +{ + UHD_SAFE_C_SAVE_ERROR(h, *size_out = h->subdev_spec_cpp.size();) } -uhd_error uhd_subdev_spec_push_back( - uhd_subdev_spec_handle h, - const char* markup -){ - UHD_SAFE_C_SAVE_ERROR(h, - h->subdev_spec_cpp.push_back(uhd::usrp::subdev_spec_pair_t(markup)); - ) +uhd_error uhd_subdev_spec_push_back(uhd_subdev_spec_handle h, const char* markup) +{ + UHD_SAFE_C_SAVE_ERROR( + h, h->subdev_spec_cpp.push_back(uhd::usrp::subdev_spec_pair_t(markup));) } uhd_error uhd_subdev_spec_at( - uhd_subdev_spec_handle h, - size_t num, - uhd_subdev_spec_pair_t *subdev_spec_pair_out -){ - UHD_SAFE_C_SAVE_ERROR(h, - uhd_subdev_spec_pair_cpp_to_c( - h->subdev_spec_cpp.at(num), - subdev_spec_pair_out - ); - ) + uhd_subdev_spec_handle h, size_t num, uhd_subdev_spec_pair_t* subdev_spec_pair_out) +{ + UHD_SAFE_C_SAVE_ERROR( + h, + uhd_subdev_spec_pair_cpp_to_c(h->subdev_spec_cpp.at(num), subdev_spec_pair_out);) } uhd_error uhd_subdev_spec_to_pp_string( - uhd_subdev_spec_handle h, - char* pp_string_out, - size_t strbuffer_len -){ - UHD_SAFE_C_SAVE_ERROR(h, - std::string pp_string_cpp = h->subdev_spec_cpp.to_pp_string(); + uhd_subdev_spec_handle h, char* pp_string_out, size_t strbuffer_len) +{ + UHD_SAFE_C_SAVE_ERROR( + h, std::string pp_string_cpp = h->subdev_spec_cpp.to_pp_string(); memset(pp_string_out, '\0', strbuffer_len); - strncpy(pp_string_out, pp_string_cpp.c_str(), strbuffer_len); - ) + strncpy(pp_string_out, pp_string_cpp.c_str(), strbuffer_len);) } uhd_error uhd_subdev_spec_to_string( - uhd_subdev_spec_handle h, - char* string_out, - size_t strbuffer_len -){ - UHD_SAFE_C_SAVE_ERROR(h, - std::string string_cpp = h->subdev_spec_cpp.to_string(); - memset(string_out, '\0', strbuffer_len); - strncpy(string_out, string_cpp.c_str(), strbuffer_len); - ) + uhd_subdev_spec_handle h, char* string_out, size_t strbuffer_len) +{ + UHD_SAFE_C_SAVE_ERROR(h, std::string string_cpp = h->subdev_spec_cpp.to_string(); + memset(string_out, '\0', strbuffer_len); + strncpy(string_out, string_cpp.c_str(), strbuffer_len);) } uhd_error uhd_subdev_spec_last_error( - uhd_subdev_spec_handle h, - char* error_out, - size_t strbuffer_len -){ - UHD_SAFE_C( - memset(error_out, '\0', strbuffer_len); - strncpy(error_out, h->last_error.c_str(), strbuffer_len); - ) + uhd_subdev_spec_handle h, char* error_out, size_t strbuffer_len) +{ + UHD_SAFE_C(memset(error_out, '\0', strbuffer_len); + strncpy(error_out, h->last_error.c_str(), strbuffer_len);) } uhd::usrp::subdev_spec_pair_t uhd_subdev_spec_pair_c_to_cpp( - const uhd_subdev_spec_pair_t *subdev_spec_pair_c -){ - return uhd::usrp::subdev_spec_pair_t(subdev_spec_pair_c->db_name, - subdev_spec_pair_c->sd_name); + const uhd_subdev_spec_pair_t* subdev_spec_pair_c) +{ + return uhd::usrp::subdev_spec_pair_t( + subdev_spec_pair_c->db_name, subdev_spec_pair_c->sd_name); } void uhd_subdev_spec_pair_cpp_to_c( - const uhd::usrp::subdev_spec_pair_t &subdev_spec_pair_cpp, - uhd_subdev_spec_pair_t *subdev_spec_pair_c -){ + const uhd::usrp::subdev_spec_pair_t& subdev_spec_pair_cpp, + uhd_subdev_spec_pair_t* subdev_spec_pair_c) +{ subdev_spec_pair_c->db_name = strdup(subdev_spec_pair_cpp.db_name.c_str()); subdev_spec_pair_c->sd_name = strdup(subdev_spec_pair_cpp.sd_name.c_str()); } |