aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-01-08 13:23:17 +0100
committerAaron Rossetto <aaron.rossetto@ni.com>2021-03-04 08:24:09 -0600
commit47623aabb4832d3d217faa1a9938bb7a6e4341c3 (patch)
treeb67dec95e65ca8aacd4352413506c8869480e450 /host
parent49e5ef81530684998bc4bc0934590cdaa81190ab (diff)
downloaduhd-47623aabb4832d3d217faa1a9938bb7a6e4341c3.tar.gz
uhd-47623aabb4832d3d217faa1a9938bb7a6e4341c3.tar.bz2
uhd-47623aabb4832d3d217faa1a9938bb7a6e4341c3.zip
lib: Use const-ref in for loops instead of const-copy
This is potentially a performance issue, even though it doesn't have a big impact in this context. Clang will warn about it, and this fixes the compiler warning.
Diffstat (limited to 'host')
-rw-r--r--host/lib/image_loader.cpp2
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp2
-rw-r--r--host/lib/usrp/cores/gpio_atr_3000.cpp2
-rw-r--r--host/lib/usrp/dboard/db_tvrx.cpp2
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_control_init.cpp4
-rw-r--r--host/lib/usrp/x300/x300_radio_control.cpp2
-rw-r--r--host/utils/uhd_usrp_probe.cpp4
7 files changed, 9 insertions, 9 deletions
diff --git a/host/lib/image_loader.cpp b/host/lib/image_loader.cpp
index 38fed1c87..bb1fb3558 100644
--- a/host/lib/image_loader.cpp
+++ b/host/lib/image_loader.cpp
@@ -59,7 +59,7 @@ bool uhd::image_loader::load(
} else
return get_image_loaders().at(type)(image_loader_args);
} else {
- for (const loader_fcn_pair_t& loader_fcn_pair : get_image_loaders()) {
+ for (const auto& loader_fcn_pair : get_image_loaders()) {
if (loader_fcn_pair.second(image_loader_args))
return true;
}
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index 1205843ae..65d009e61 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -750,7 +750,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 auto& attr : gpio_attr_map) {
switch (attr.first) {
case usrp::gpio_atr::GPIO_SRC:
_tree
diff --git a/host/lib/usrp/cores/gpio_atr_3000.cpp b/host/lib/usrp/cores/gpio_atr_3000.cpp
index 875752ee2..0c7eeebda 100644
--- a/host/lib/usrp/cores/gpio_atr_3000.cpp
+++ b/host/lib/usrp/cores/gpio_atr_3000.cpp
@@ -54,7 +54,7 @@ public:
_atr_fdx_reg.initialize(*_iface, true);
_ddr_reg.initialize(*_iface, true);
_atr_disable_reg.initialize(*_iface, true);
- for (const gpio_attr_map_t::value_type attr : gpio_attr_map) {
+ for (const auto& attr : gpio_attr_map) {
if (attr.first == usrp::gpio_atr::GPIO_SRC
|| attr.first == usrp::gpio_atr::GPIO_READBACK) {
// Don't set the SRC and READBACK, they're handled elsewhere.
diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp
index 02fed018c..c9a940d15 100644
--- a/host/lib/usrp/dboard/db_tvrx.cpp
+++ b/host/lib/usrp/dboard/db_tvrx.cpp
@@ -158,7 +158,7 @@ static const boost::array<double, 17> tvrx_gains_volts = {{0.8,
static uhd::dict<std::string, gain_range_t> 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/dboard/magnesium/magnesium_radio_control_init.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_control_init.cpp
index 82da7ec75..98c370275 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_control_init.cpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_control_init.cpp
@@ -227,7 +227,7 @@ void magnesium_radio_control_impl::_init_frontend_subtree(
// TX gains
std::vector<std::string> tx_gain_names = get_tx_gain_names(chan_idx);
tx_gain_names.push_back("all");
- for (const auto gain_name : tx_gain_names) {
+ for (const auto& gain_name : tx_gain_names) {
subtree->create<double>(tx_fe_path / "gains" / gain_name / "value")
.set_coercer([this, chan_idx, gain_name](const double gain) {
return this->set_tx_gain(gain, gain_name, chan_idx);
@@ -256,7 +256,7 @@ void magnesium_radio_control_impl::_init_frontend_subtree(
// RX gains
std::vector<std::string> rx_gain_names = get_rx_gain_names(chan_idx);
rx_gain_names.push_back("all");
- for (const auto gain_name : rx_gain_names) {
+ for (const auto& gain_name : rx_gain_names) {
subtree->create<double>(rx_fe_path / "gains" / gain_name / "value")
.set_coercer([this, chan_idx, gain_name](const double gain) {
return this->set_rx_gain(gain, gain_name, chan_idx);
diff --git a/host/lib/usrp/x300/x300_radio_control.cpp b/host/lib/usrp/x300/x300_radio_control.cpp
index 893a99942..36813d044 100644
--- a/host/lib/usrp/x300/x300_radio_control.cpp
+++ b/host/lib/usrp/x300/x300_radio_control.cpp
@@ -159,7 +159,7 @@ public:
// TODO: Do we need this section? Since the _fp_gpio handles state now, we
// don't need to stash values here. We only need this if we want to set
// anything to a default value.
- for (const gpio_atr::gpio_attr_map_t::value_type attr : gpio_atr::gpio_attr_map) {
+ for (const auto& attr : gpio_atr::gpio_attr_map) {
// TODO: Default values?
if (attr.first == usrp::gpio_atr::GPIO_SRC) {
// Don't set the SRC
diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp
index 50eabc55b..7a6b6eb14 100644
--- a/host/utils/uhd_usrp_probe.cpp
+++ b/host/utils/uhd_usrp_probe.cpp
@@ -193,8 +193,8 @@ static std::string get_rfnoc_blocks_pp_string(rfnoc::rfnoc_graph::sptr graph)
{
std::stringstream ss;
ss << "RFNoC blocks on this device:" << std::endl << std::endl;
- for (const std::string& name : graph->find_blocks("")) {
- ss << "* " << name << std::endl;
+ for (const auto& name : graph->find_blocks("")) {
+ ss << "* " << name.to_string() << std::endl;
}
return ss.str();
}