mirror of
https://github.com/monero-project/monero.git
synced 2025-07-27 16:25:32 -04:00
Remove copies from foreach loops (thanks to Clang)
This commit is contained in:
parent
1572df9e26
commit
bd129849f0
8 changed files with 17 additions and 17 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -9466,7 +9466,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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue