Skip to content

Commit 3eff827

Browse files
committed
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-
1 parent 33aed5b commit 3eff827

5 files changed

+7
-7
lines changed

src/checkpoints.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Checkpoints {
2020
{
2121
const MapCheckpoints& checkpoints = data.mapCheckpoints;
2222

23-
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)
23+
for (const MapCheckpoints::value_type& i : reverse_iterate(checkpoints))
2424
{
2525
const uint256& hash = i.second;
2626
BlockMap::const_iterator t = mapBlockIndex.find(hash);

src/net_processing.cpp

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

src/test/prevector_tests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ class prevector_tester {
5757
for (const T& v : pre_vector) {
5858
local_check(v == real_vector[pos++]);
5959
}
60-
BOOST_REVERSE_FOREACH(const T& v, pre_vector) {
60+
for (const T& v : reverse_iterate(pre_vector)) {
6161
local_check(v == real_vector[--pos]);
6262
}
6363
for (const T& v : const_pre_vector) {
6464
local_check(v == real_vector[pos++]);
6565
}
66-
BOOST_REVERSE_FOREACH(const T& v, const_pre_vector) {
66+
for (const T& v : reverse_iterate(const_pre_vector)) {
6767
local_check(v == real_vector[--pos]);
6868
}
6969
CDataStream ss1(SER_DISK, 0);

src/txmempool.cpp

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

src/validation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,7 @@ static bool ActivateBestChainStep(CValidationState& state, const CChainParams& c
22172217
nHeight = nTargetHeight;
22182218

22192219
// Connect new blocks.
2220-
BOOST_REVERSE_FOREACH(CBlockIndex *pindexConnect, vpindexToConnect) {
2220+
for (CBlockIndex *pindexConnect : reverse_iterate(vpindexToConnect)) {
22212221
if (!ConnectTip(state, chainparams, pindexConnect, pindexConnect == pindexMostWork ? pblock : std::shared_ptr<const CBlock>(), connectTrace, disconnectpool)) {
22222222
if (state.IsInvalid()) {
22232223
// The block violates a consensus rule.

0 commit comments

Comments
 (0)