From e35f66e82f3d970aed7cd0c66ea3114f9acfe853 Mon Sep 17 00:00:00 2001 From: "A. Maitland Bottoms" Date: Thu, 21 Oct 2021 09:16:29 -0500 Subject: uhd: Use reference type to prevent copy Thanks to mait for the fixes! --- host/lib/rfnoc/async_msg_handler.cpp | 2 +- host/lib/rfnoc/sink_block_ctrl_base.cpp | 2 +- host/lib/rfnoc/source_block_ctrl_base.cpp | 2 +- host/lib/usrp/b200/b200_impl.cpp | 2 +- host/lib/usrp/dboard/db_tvrx.cpp | 2 +- host/lib/usrp/n230/n230_impl.cpp | 2 +- host/lib/usrp/x300/x300_radio_ctrl_impl.cpp | 2 +- host/tests/blockdef_test.cpp | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/host/lib/rfnoc/async_msg_handler.cpp b/host/lib/rfnoc/async_msg_handler.cpp index 6b7d7d057..0f325b450 100644 --- a/host/lib/rfnoc/async_msg_handler.cpp +++ b/host/lib/rfnoc/async_msg_handler.cpp @@ -56,7 +56,7 @@ public: { std::lock_guard lock(_mutex); - for (auto const event_handler : _event_handlers) { + for (const auto& event_handler : _event_handlers) { // If the event code in the message matches the event code used at // registration time, call the event handler if ((metadata.event_code & event_handler.first) == event_handler.first) { diff --git a/host/lib/rfnoc/sink_block_ctrl_base.cpp b/host/lib/rfnoc/sink_block_ctrl_base.cpp index f1d65350a..fcd95636c 100644 --- a/host/lib/rfnoc/sink_block_ctrl_base.cpp +++ b/host/lib/rfnoc/sink_block_ctrl_base.cpp @@ -32,7 +32,7 @@ std::vector sink_block_ctrl_base::get_input_ports() const { std::vector input_ports; input_ports.reserve(_tree->list(_root_path / "ports" / "in").size()); - for (const std::string port : _tree->list(_root_path / "ports" / "in")) { + for (const std::string& port : _tree->list(_root_path / "ports" / "in")) { input_ports.push_back(boost::lexical_cast(port)); } return input_ports; diff --git a/host/lib/rfnoc/source_block_ctrl_base.cpp b/host/lib/rfnoc/source_block_ctrl_base.cpp index 91fe705b2..4a5547379 100644 --- a/host/lib/rfnoc/source_block_ctrl_base.cpp +++ b/host/lib/rfnoc/source_block_ctrl_base.cpp @@ -64,7 +64,7 @@ std::vector source_block_ctrl_base::get_output_ports() const { std::vector output_ports; output_ports.reserve(_tree->list(_root_path / "ports" / "out").size()); - for (const std::string port : _tree->list(_root_path / "ports" / "out")) { + for (const std::string& port : _tree->list(_root_path / "ports" / "out")) { output_ports.push_back(boost::lexical_cast(port)); } return output_ports; diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 7cffae0ff..7c062732a 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -742,7 +742,7 @@ b200_impl::b200_impl( //////////////////////////////////////////////////////////////////// _radio_perifs[0].fp_gpio = gpio_atr_3000::make(_radio_perifs[0].ctrl, TOREG(SR_FP_GPIO), RB32_FP_GPIO); - for (const gpio_attr_map_t::value_type attr : gpio_attr_map) { + for (const gpio_attr_map_t::value_type& attr : gpio_attr_map) { switch (attr.first) { case usrp::gpio_atr::GPIO_SRC: _tree diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp index f2c795eee..fbad595f6 100644 --- a/host/lib/usrp/dboard/db_tvrx.cpp +++ b/host/lib/usrp/dboard/db_tvrx.cpp @@ -156,7 +156,7 @@ static const boost::array tvrx_gains_volts = {{0.8, static uhd::dict get_tvrx_gain_ranges(void) { double rfmax = 0.0, rfmin = FLT_MAX; - for (const std::string range : tvrx_rf_gains_db.keys()) { + for (const std::string& range : tvrx_rf_gains_db.keys()) { double my_max = tvrx_rf_gains_db[range].back(); // we're assuming it's monotonic double my_min = tvrx_rf_gains_db[range].front(); // if it's not this is wrong wrong wrong diff --git a/host/lib/usrp/n230/n230_impl.cpp b/host/lib/usrp/n230/n230_impl.cpp index 55aa917e0..9e4050648 100644 --- a/host/lib/usrp/n230/n230_impl.cpp +++ b/host/lib/usrp/n230/n230_impl.cpp @@ -426,7 +426,7 @@ void n230_impl::_initialize_property_tree(const fs_path& mb_path) //------------------------------------------------------------------ // MiniSAS GPIO //------------------------------------------------------------------ - for (const usrp::gpio_atr::gpio_attr_map_t::value_type attr : + for (const usrp::gpio_atr::gpio_attr_map_t::value_type& attr : usrp::gpio_atr::gpio_attr_map) { switch (attr.first) { case usrp::gpio_atr::GPIO_SRC: diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp index 8cb80282b..93dd830b9 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp @@ -93,7 +93,7 @@ UHD_RFNOC_RADIO_BLOCK_CONSTRUCTOR(x300_radio_ctrl) if (_radio_type == PRIMARY) { _fp_gpio = gpio_atr::gpio_atr_3000::make( ctrl, regs::sr_addr(regs::FP_GPIO), regs::rb_addr(regs::RB_FP_GPIO)); - for (const gpio_atr::gpio_attr_map_t::value_type attr : gpio_atr::gpio_attr_map) { + for (const gpio_atr::gpio_attr_map_t::value_type& attr : gpio_atr::gpio_attr_map) { switch (attr.first) { case usrp::gpio_atr::GPIO_SRC: _tree diff --git a/host/tests/blockdef_test.cpp b/host/tests/blockdef_test.cpp index 7a663f514..a95cbdc00 100644 --- a/host/tests/blockdef_test.cpp +++ b/host/tests/blockdef_test.cpp @@ -24,7 +24,7 @@ BOOST_AUTO_TEST_CASE(test_lookup) {0x5CC0000000000000, "SchmidlCox"}}; std::cout << blocknames.size() << std::endl; - for (const auto block : blocknames) { + for (const auto& block : blocknames) { std::cout << "Testing " << block.second << " => " << str(boost::format("%016X") % block.first) << std::endl; auto block_definition = blockdef::make_from_noc_id(block.first); -- cgit v1.2.3-59-g8ed1b