Browse Source

scripted-diff: Remove BOOST_REVERSE_FOREACH

-BEGIN VERIFY SCRIPT-
sed -i 's/BOOST_REVERSE_FOREACH(\(.*\), \(.*\))/for (\1 : reverse_iterate(\2))/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ;
-END VERIFY SCRIPT-
0.15
Jorge Timón 8 years ago
parent
commit
3eff827f89
No known key found for this signature in database
GPG Key ID: A4F5D141C01A0387
  1. 2
      src/checkpoints.cpp
  2. 4
      src/net_processing.cpp
  3. 4
      src/test/prevector_tests.cpp
  4. 2
      src/txmempool.cpp
  5. 2
      src/validation.cpp

2
src/checkpoints.cpp

@ -20,7 +20,7 @@ namespace Checkpoints {
{ {
const MapCheckpoints& checkpoints = data.mapCheckpoints; const MapCheckpoints& checkpoints = data.mapCheckpoints;
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints) for (const MapCheckpoints::value_type& i : reverse_iterate(checkpoints))
{ {
const uint256& hash = i.second; const uint256& hash = i.second;
BlockMap::const_iterator t = mapBlockIndex.find(hash); BlockMap::const_iterator t = mapBlockIndex.find(hash);

4
src/net_processing.cpp

@ -845,7 +845,7 @@ void PeerLogicValidation::UpdatedBlockTip(const CBlockIndex *pindexNew, const CB
// Relay inventory, but don't relay old inventory during initial block download. // Relay inventory, but don't relay old inventory during initial block download.
connman->ForEachNode([nNewHeight, &vHashes](CNode* pnode) { connman->ForEachNode([nNewHeight, &vHashes](CNode* pnode) {
if (nNewHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 0)) { if (nNewHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 0)) {
BOOST_REVERSE_FOREACH(const uint256& hash, vHashes) { for (const uint256& hash : reverse_iterate(vHashes)) {
pnode->PushBlockHash(hash); pnode->PushBlockHash(hash);
} }
} }
@ -2356,7 +2356,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
} else { } else {
std::vector<CInv> vGetData; std::vector<CInv> vGetData;
// Download as much as possible, from earliest to latest. // Download as much as possible, from earliest to latest.
BOOST_REVERSE_FOREACH(const CBlockIndex *pindex, vToFetch) { for (const CBlockIndex *pindex : reverse_iterate(vToFetch)) {
if (nodestate->nBlocksInFlight >= MAX_BLOCKS_IN_TRANSIT_PER_PEER) { if (nodestate->nBlocksInFlight >= MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
// Can't download any more from this peer // Can't download any more from this peer
break; break;

4
src/test/prevector_tests.cpp

@ -57,13 +57,13 @@ class prevector_tester {
for (const T& v : pre_vector) { for (const T& v : pre_vector) {
local_check(v == real_vector[pos++]); local_check(v == real_vector[pos++]);
} }
BOOST_REVERSE_FOREACH(const T& v, pre_vector) { for (const T& v : reverse_iterate(pre_vector)) {
local_check(v == real_vector[--pos]); local_check(v == real_vector[--pos]);
} }
for (const T& v : const_pre_vector) { for (const T& v : const_pre_vector) {
local_check(v == real_vector[pos++]); local_check(v == real_vector[pos++]);
} }
BOOST_REVERSE_FOREACH(const T& v, const_pre_vector) { for (const T& v : reverse_iterate(const_pre_vector)) {
local_check(v == real_vector[--pos]); local_check(v == real_vector[--pos]);
} }
CDataStream ss1(SER_DISK, 0); CDataStream ss1(SER_DISK, 0);

2
src/txmempool.cpp

@ -128,7 +128,7 @@ void CTxMemPool::UpdateTransactionsFromBlock(const std::vector<uint256> &vHashes
// This maximizes the benefit of the descendant cache and guarantees that // This maximizes the benefit of the descendant cache and guarantees that
// setMemPoolChildren will be updated, an assumption made in // setMemPoolChildren will be updated, an assumption made in
// UpdateForDescendants. // UpdateForDescendants.
BOOST_REVERSE_FOREACH(const uint256 &hash, vHashesToUpdate) { for (const uint256 &hash : reverse_iterate(vHashesToUpdate)) {
// we cache the in-mempool children to avoid duplicate updates // we cache the in-mempool children to avoid duplicate updates
setEntries setChildren; setEntries setChildren;
// calculate children from mapNextTx // calculate children from mapNextTx

2
src/validation.cpp

@ -2217,7 +2217,7 @@ static bool ActivateBestChainStep(CValidationState& state, const CChainParams& c
nHeight = nTargetHeight; nHeight = nTargetHeight;
// Connect new blocks. // Connect new blocks.
BOOST_REVERSE_FOREACH(CBlockIndex *pindexConnect, vpindexToConnect) { for (CBlockIndex *pindexConnect : reverse_iterate(vpindexToConnect)) {
if (!ConnectTip(state, chainparams, pindexConnect, pindexConnect == pindexMostWork ? pblock : std::shared_ptr<const CBlock>(), connectTrace, disconnectpool)) { if (!ConnectTip(state, chainparams, pindexConnect, pindexConnect == pindexMostWork ? pblock : std::shared_ptr<const CBlock>(), connectTrace, disconnectpool)) {
if (state.IsInvalid()) { if (state.IsInvalid()) {
// The block violates a consensus rule. // The block violates a consensus rule.

Loading…
Cancel
Save