aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-13 11:21:18 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-18 15:15:54 +0000
commitb51dc5668714a88d79ddb410d0dcab1559a4bc98 (patch)
tree343b7443c8193c90eb83bcb96a9d16ae4d2f6e52
parentnet_parse_helpers: fix regex error checking (diff)
downloadmonero-b51dc5668714a88d79ddb410d0dcab1559a4bc98.tar.xz
use const refs in for loops for non tiny types
-rw-r--r--src/blockchain_utilities/blockchain_import.cpp2
-rw-r--r--src/cryptonote_protocol/block_queue.cpp2
-rw-r--r--src/daemon/rpc_command_executor.cpp2
-rw-r--r--src/debug_utilities/object_sizes.cpp2
-rw-r--r--src/wallet/wallet2.cpp2
5 files changed, 5 insertions, 5 deletions
diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp
index 70d1dd696..758deb7e4 100644
--- a/src/blockchain_utilities/blockchain_import.cpp
+++ b/src/blockchain_utilities/blockchain_import.cpp
@@ -459,7 +459,7 @@ int import_from_file(cryptonote::core& core, const std::string& import_file_path
// tx number 1: coinbase tx
// tx number 2 onwards: archived_txs
- for (transaction tx : archived_txs)
+ for (const transaction &tx : archived_txs)
{
// add blocks with verification.
// for Blockchain and blockchain_storage add_new_block().
diff --git a/src/cryptonote_protocol/block_queue.cpp b/src/cryptonote_protocol/block_queue.cpp
index 9e38ffbcb..3844d3751 100644
--- a/src/cryptonote_protocol/block_queue.cpp
+++ b/src/cryptonote_protocol/block_queue.cpp
@@ -385,7 +385,7 @@ float block_queue::get_speed(const boost::uuids::uuid &connection_id) const
i->second = (i->second + span.rate) / 2;
}
float conn_rate = -1, best_rate = 0;
- for (auto i: speeds)
+ for (const auto &i: speeds)
{
if (i.first == connection_id)
conn_rate = i.second;
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index d7ee28baa..8aca668ad 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -1611,7 +1611,7 @@ bool t_rpc_command_executor::alt_chain_info()
}
tools::msg_writer() << boost::lexical_cast<std::string>(res.chains.size()) << " alternate chains found:";
- for (const auto chain: res.chains)
+ for (const auto &chain: res.chains)
{
uint64_t start_height = (chain.height - chain.length + 1);
tools::msg_writer() << chain.length << " blocks long, from height " << start_height << " (" << (ires.height - start_height - 1)
diff --git a/src/debug_utilities/object_sizes.cpp b/src/debug_utilities/object_sizes.cpp
index 82d8a4add..967742229 100644
--- a/src/debug_utilities/object_sizes.cpp
+++ b/src/debug_utilities/object_sizes.cpp
@@ -51,7 +51,7 @@ class size_logger
public:
~size_logger()
{
- for (const auto i: types)
+ for (const auto &i: types)
std::cout << std::to_string(i.first) << "\t" << i.second << std::endl;
}
void add(const char *type, size_t size) { types.insert(std::make_pair(size, type)); }
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index e818f576a..169c572bd 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -5126,7 +5126,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
// if there are just enough outputs to mix with, use all of them.
// Eventually this should become impossible.
uint64_t num_outs = 0, num_recent_outs = 0;
- for (auto he: resp_t.result.histogram)
+ for (const auto &he: resp_t.result.histogram)
{
if (he.amount == amount)
{