aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2021-02-18 14:06:47 -0500
committerluigi1111 <luigi1111w@gmail.com>2021-02-18 14:06:47 -0500
commit6556c33f133782b682938f14360cc6aeb39901c3 (patch)
tree8ee3c410f75a25d63adc96e94c46e81174f6cb2f /src
parentMerge pull request #7352 (diff)
parentRemove copies from foreach loops (thanks to Clang) (diff)
downloadmonero-6556c33f133782b682938f14360cc6aeb39901c3.tar.xz
Merge pull request #7355
bd12984 Remove copies from foreach loops (thanks to Clang) (Lee Clagett) 1572df9 Removing unused namespace alias (Lee Clagett)
Diffstat (limited to 'src')
-rw-r--r--src/blockchain_db/blockchain_db.cpp2
-rw-r--r--src/blockchain_utilities/blockchain_ancestry.cpp4
-rw-r--r--src/cryptonote_core/blockchain.cpp2
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp2
-rw-r--r--src/simplewallet/simplewallet.cpp2
-rw-r--r--src/wallet/wallet2.cpp2
-rw-r--r--src/wallet/wallet_rpc_server.cpp2
7 files changed, 7 insertions, 9 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index a9a7d035f..5e12fa8ec 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -287,7 +287,7 @@ uint64_t BlockchainDB::add_block( const std::pair<block, blobdata>& blck
num_rct_outs += blk.miner_tx.vout.size();
int tx_i = 0;
crypto::hash tx_hash = crypto::null_hash;
- for (const std::pair<transaction, blobdata_ref>& tx : txs)
+ for (const std::pair<transaction, blobdata>& tx : txs)
{
tx_hash = blk.tx_hashes[tx_i];
add_transaction(blk_hash, tx, &tx_hash);
diff --git a/src/blockchain_utilities/blockchain_ancestry.cpp b/src/blockchain_utilities/blockchain_ancestry.cpp
index 4bf6ade5b..b1b238427 100644
--- a/src/blockchain_utilities/blockchain_ancestry.cpp
+++ b/src/blockchain_utilities/blockchain_ancestry.cpp
@@ -149,7 +149,7 @@ struct ancestry_state_t
{
std::unordered_map<crypto::hash, cryptonote::transaction> old_tx_cache;
a & old_tx_cache;
- for (const auto i: old_tx_cache)
+ for (const auto& i: old_tx_cache)
tx_cache.insert(std::make_pair(i.first, ::tx_data_t(i.second)));
}
else
@@ -161,7 +161,7 @@ struct ancestry_state_t
std::unordered_map<uint64_t, cryptonote::block> old_block_cache;
a & old_block_cache;
block_cache.resize(old_block_cache.size());
- for (const auto i: old_block_cache)
+ for (const auto& i: old_block_cache)
block_cache[i.first] = i.second;
}
else
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index a66567239..cdad39a2c 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -973,7 +973,7 @@ start:
std::pair<bool, uint64_t> Blockchain::check_difficulty_checkpoints() const
{
uint64_t res = 0;
- for (const std::pair<uint64_t, difficulty_type>& i : m_checkpoints.get_difficulty_points())
+ for (const std::pair<const uint64_t, difficulty_type>& i : m_checkpoints.get_difficulty_points())
{
if (i.first >= m_db->height())
break;
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 12125fb9d..57104fd59 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -630,7 +630,7 @@ namespace cryptonote
void operator()(std::uint64_t, epee::span<const block> blocks) const
{
- for (const block bl : blocks)
+ for (const block& bl : blocks)
cmdline.notify("%s", epee::string_tools::pod_to_hex(get_block_hash(bl)).c_str(), NULL);
}
};
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index df3bf14d9..2a3c33f48 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -9521,7 +9521,7 @@ void simple_wallet::print_accounts()
{
const std::pair<std::map<std::string, std::string>, std::vector<std::string>>& account_tags = m_wallet->get_account_tags();
size_t num_untagged_accounts = m_wallet->get_num_subaddress_accounts();
- for (const std::pair<std::string, std::string>& p : account_tags.first)
+ for (const std::pair<const std::string, std::string>& p : account_tags.first)
{
const std::string& tag = p.first;
print_accounts(tag);
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index e2e4bd57f..e298eca53 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -345,8 +345,6 @@ std::string get_weight_string(const cryptonote::transaction &tx, size_t blob_siz
std::unique_ptr<tools::wallet2> make_basic(const boost::program_options::variables_map& vm, bool unattended, const options& opts, const std::function<boost::optional<tools::password_container>(const char *, bool)> &password_prompter)
{
- namespace ip = boost::asio::ip;
-
const bool testnet = command_line::get_arg(vm, opts.testnet);
const bool stagenet = command_line::get_arg(vm, opts.stagenet);
const network_type nettype = testnet ? TESTNET : stagenet ? STAGENET : MAINNET;
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index 0c59e7f8f..327a189ca 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -687,7 +687,7 @@ namespace tools
{
if (!m_wallet) return not_open(er);
const std::pair<std::map<std::string, std::string>, std::vector<std::string>> account_tags = m_wallet->get_account_tags();
- for (const std::pair<std::string, std::string>& p : account_tags.first)
+ for (const std::pair<const std::string, std::string>& p : account_tags.first)
{
res.account_tags.resize(res.account_tags.size() + 1);
auto& info = res.account_tags.back();