Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.

This commit is contained in:
practicalswift
2018-06-18 07:58:28 +02:00
parent f180e81d57
commit f34c8c466a
36 changed files with 77 additions and 77 deletions

View File

@@ -421,7 +421,7 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp, bool
// lock on a mempool input, so we can use the return value of
// CheckSequenceLocks to indicate the LockPoints validity
int maxInputHeight = 0;
for (int height : prevheights) {
for (const int height : prevheights) {
// Can ignore mempool inputs since we'll fail if they had non-zero locks
if (height != tip->nHeight+1) {
maxInputHeight = std::max(maxInputHeight, height);
@@ -4291,7 +4291,7 @@ void UnloadBlockIndex()
warningcache[b].clear();
}
for (BlockMap::value_type& entry : mapBlockIndex) {
for (const BlockMap::value_type& entry : mapBlockIndex) {
delete entry.second;
}
mapBlockIndex.clear();
@@ -4492,7 +4492,7 @@ void CChainState::CheckBlockIndex(const Consensus::Params& consensusParams)
// Build forward-pointing map of the entire block tree.
std::multimap<CBlockIndex*,CBlockIndex*> forward;
for (auto& entry : mapBlockIndex) {
for (const std::pair<const uint256, CBlockIndex*>& entry : mapBlockIndex) {
forward.insert(std::make_pair(entry.second->pprev, entry.second));
}