Skip to content

Commit 7c00c26

Browse files
committed
scripted-diff: Fully remove BOOST_FOREACH
-BEGIN VERIFY SCRIPT- sed -i 's/BOOST_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ; -END VERIFY SCRIPT-
1 parent a5410ac commit 7c00c26

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+266
-266
lines changed

src/bench/coin_selection.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void CoinSelection(benchmark::State& state)
3939

4040
while (state.KeepRunning()) {
4141
// Empty wallet.
42-
BOOST_FOREACH (COutput output, vCoins)
42+
for (COutput output : vCoins)
4343
delete output.tx;
4444
vCoins.clear();
4545

src/bitcoin-tx.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
611611
ProduceSignature(MutableTransactionSignatureCreator(&keystore, &mergedTx, i, amount, nHashType), prevPubKey, sigdata);
612612

613613
// ... and merge in other signatures:
614-
BOOST_FOREACH(const CTransaction& txv, txVariants)
614+
for (const CTransaction& txv : txVariants)
615615
sigdata = CombineSignatures(prevPubKey, MutableTransactionSignatureChecker(&mergedTx, i, amount), sigdata, DataFromTransaction(txv, i));
616616
UpdateTransaction(mergedTx, i, sigdata);
617617

src/bloom.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx)
179179
if (fFound)
180180
return true;
181181

182-
BOOST_FOREACH(const CTxIn& txin, tx.vin)
182+
for (const CTxIn& txin : tx.vin)
183183
{
184184
// Match if the filter contains an outpoint tx spends
185185
if (contains(txin.prevout))

src/checkqueue.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class CCheckQueue
121121
fOk = fAllOk;
122122
}
123123
// execute work
124-
BOOST_FOREACH (T& check, vChecks)
124+
for (T& check : vChecks)
125125
if (fOk)
126126
fOk = check();
127127
vChecks.clear();
@@ -151,7 +151,7 @@ class CCheckQueue
151151
void Add(std::vector<T>& vChecks)
152152
{
153153
boost::unique_lock<boost::mutex> lock(mutex);
154-
BOOST_FOREACH (T& check, vChecks) {
154+
for (T& check : vChecks) {
155155
queue.push_back(T());
156156
check.swap(queue.back());
157157
}

src/core_write.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
141141
out.pushKV("type", GetTxnOutputType(type));
142142

143143
UniValue a(UniValue::VARR);
144-
BOOST_FOREACH(const CTxDestination& addr, addresses)
144+
for (const CTxDestination& addr : addresses)
145145
a.push_back(CBitcoinAddress(addr).ToString());
146146
out.pushKV("addresses", a);
147147
}

src/httprpc.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static bool multiUserAuthorized(std::string strUserPass)
9595

9696
if (gArgs.IsArgSet("-rpcauth")) {
9797
//Search for multi-user login/pass "rpcauth" from config
98-
BOOST_FOREACH(std::string strRPCAuth, gArgs.GetArgs("-rpcauth"))
98+
for (std::string strRPCAuth : gArgs.GetArgs("-rpcauth"))
9999
{
100100
std::vector<std::string> vFields;
101101
boost::split(vFields, strRPCAuth, boost::is_any_of(":$"));

src/init.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ void CleanupBlockRevFiles()
611611
// keeping a separate counter. Once we hit a gap (or if 0 doesn't exist)
612612
// start removing block files.
613613
int nContigCounter = 0;
614-
BOOST_FOREACH(const PAIRTYPE(std::string, fs::path)& item, mapBlockFiles) {
614+
for (const PAIRTYPE(std::string, fs::path)& item : mapBlockFiles) {
615615
if (atoi(item.first) == nContigCounter) {
616616
nContigCounter++;
617617
continue;
@@ -664,7 +664,7 @@ void ThreadImport(std::vector<fs::path> vImportFiles)
664664
}
665665

666666
// -loadblock=
667-
BOOST_FOREACH(const fs::path& path, vImportFiles) {
667+
for (const fs::path& path : vImportFiles) {
668668
FILE *file = fsbridge::fopen(path, "rb");
669669
if (file) {
670670
LogPrintf("Importing blocks file %s...\n", path.string());
@@ -1258,7 +1258,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
12581258
// sanitize comments per BIP-0014, format user agent and check total size
12591259
std::vector<std::string> uacomments;
12601260
if (gArgs.IsArgSet("-uacomment")) {
1261-
BOOST_FOREACH(std::string cmt, gArgs.GetArgs("-uacomment"))
1261+
for (std::string cmt : gArgs.GetArgs("-uacomment"))
12621262
{
12631263
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
12641264
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
@@ -1273,7 +1273,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
12731273

12741274
if (gArgs.IsArgSet("-onlynet")) {
12751275
std::set<enum Network> nets;
1276-
BOOST_FOREACH(const std::string& snet, gArgs.GetArgs("-onlynet")) {
1276+
for (const std::string& snet : gArgs.GetArgs("-onlynet")) {
12771277
enum Network net = ParseNetwork(snet);
12781278
if (net == NET_UNROUTABLE)
12791279
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet));
@@ -1287,7 +1287,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
12871287
}
12881288

12891289
if (gArgs.IsArgSet("-whitelist")) {
1290-
BOOST_FOREACH(const std::string& net, gArgs.GetArgs("-whitelist")) {
1290+
for (const std::string& net : gArgs.GetArgs("-whitelist")) {
12911291
CSubNet subnet;
12921292
LookupSubNet(net.c_str(), subnet);
12931293
if (!subnet.IsValid())
@@ -1349,15 +1349,15 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
13491349
if (fListen) {
13501350
bool fBound = false;
13511351
if (gArgs.IsArgSet("-bind")) {
1352-
BOOST_FOREACH(const std::string& strBind, gArgs.GetArgs("-bind")) {
1352+
for (const std::string& strBind : gArgs.GetArgs("-bind")) {
13531353
CService addrBind;
13541354
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false))
13551355
return InitError(ResolveErrMsg("bind", strBind));
13561356
fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR));
13571357
}
13581358
}
13591359
if (gArgs.IsArgSet("-whitebind")) {
1360-
BOOST_FOREACH(const std::string& strBind, gArgs.GetArgs("-whitebind")) {
1360+
for (const std::string& strBind : gArgs.GetArgs("-whitebind")) {
13611361
CService addrBind;
13621362
if (!Lookup(strBind.c_str(), addrBind, 0, false))
13631363
return InitError(ResolveErrMsg("whitebind", strBind));
@@ -1377,7 +1377,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
13771377
}
13781378

13791379
if (gArgs.IsArgSet("-externalip")) {
1380-
BOOST_FOREACH(const std::string& strAddr, gArgs.GetArgs("-externalip")) {
1380+
for (const std::string& strAddr : gArgs.GetArgs("-externalip")) {
13811381
CService addrLocal;
13821382
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
13831383
AddLocal(addrLocal, LOCAL_MANUAL);
@@ -1616,7 +1616,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
16161616
std::vector<fs::path> vImportFiles;
16171617
if (gArgs.IsArgSet("-loadblock"))
16181618
{
1619-
BOOST_FOREACH(const std::string& strFile, gArgs.GetArgs("-loadblock"))
1619+
for (const std::string& strFile : gArgs.GetArgs("-loadblock"))
16201620
vImportFiles.push_back(strFile);
16211621
}
16221622

src/miner.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ bool BlockAssembler::TestPackage(uint64_t packageSize, int64_t packageSigOpsCost
242242
bool BlockAssembler::TestPackageTransactions(const CTxMemPool::setEntries& package)
243243
{
244244
uint64_t nPotentialBlockSize = nBlockSize; // only used with fNeedSizeAccounting
245-
BOOST_FOREACH (const CTxMemPool::txiter it, package) {
245+
for (const CTxMemPool::txiter it : package) {
246246
if (!IsFinalTx(it->GetTx(), nHeight, nLockTimeCutoff))
247247
return false;
248248
if (!fIncludeWitness && it->GetTx().HasWitness())
@@ -284,11 +284,11 @@ int BlockAssembler::UpdatePackagesForAdded(const CTxMemPool::setEntries& already
284284
indexed_modified_transaction_set &mapModifiedTx)
285285
{
286286
int nDescendantsUpdated = 0;
287-
BOOST_FOREACH(const CTxMemPool::txiter it, alreadyAdded) {
287+
for (const CTxMemPool::txiter it : alreadyAdded) {
288288
CTxMemPool::setEntries descendants;
289289
mempool.CalculateDescendants(it, descendants);
290290
// Insert all descendants (not yet in block) into the modified set
291-
BOOST_FOREACH(CTxMemPool::txiter desc, descendants) {
291+
for (CTxMemPool::txiter desc : descendants) {
292292
if (alreadyAdded.count(desc))
293293
continue;
294294
++nDescendantsUpdated;

0 commit comments

Comments
 (0)