diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-09-04 15:36:09 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-09-04 15:50:08 +0200 |
commit | 5c24d3b98cb7bb0474e14eda8452356b4573879d (patch) | |
tree | 6c2d5fa50efe839a947650466e0bf721776c64b8 /src/txmempool.cpp | |
parent | bdfeb5dfa8d8c9dc178af05881d33c66d171391e (diff) | |
parent | f34c8c466a0e514edac2e8683127b4176ad5d321 (diff) |
Merge #13249: Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.
f34c8c466a0e514edac2e8683127b4176ad5d321 Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. (practicalswift)
Pull request description:
Make objects in range declarations immutable by default.
Rationale:
* Immutable objects are easier to reason about.
* Prevents accidental or hard-to-notice change of value.
Tree-SHA512: cad69d35f0cf8a938b848e65dd537c621d96fe3369be306b65ef0cd1baf6cc0a9f28bc230e1e383d810c555a6743d08cb6b2b0bd51856d4611f537a12e5abb8b
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r-- | src/txmempool.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 05217149e3..39434e4bb6 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -193,7 +193,7 @@ bool CTxMemPool::CalculateMemPoolAncestors(const CTxMemPoolEntry &entry, setEntr } const setEntries & setMemPoolParents = GetMemPoolParents(stageit); - for (const txiter &phash : setMemPoolParents) { + for (txiter phash : setMemPoolParents) { // If this is a new ancestor, add it. if (setAncestors.count(phash) == 0) { parentHashes.insert(phash); @@ -454,7 +454,7 @@ void CTxMemPool::CalculateDescendants(txiter entryit, setEntries& setDescendants stage.erase(it); const setEntries &setChildren = GetMemPoolChildren(it); - for (const txiter &childiter : setChildren) { + for (txiter childiter : setChildren) { if (!setDescendants.count(childiter)) { stage.insert(childiter); } @@ -899,7 +899,7 @@ size_t CTxMemPool::DynamicMemoryUsage() const { void CTxMemPool::RemoveStaged(setEntries &stage, bool updateDescendants, MemPoolRemovalReason reason) { AssertLockHeld(cs); UpdateForRemoveFromMempool(stage, updateDescendants); - for (const txiter& it : stage) { + for (txiter it : stage) { removeUnchecked(it, reason); } } |