Skip to content

Commit 1ad3d4e

Browse files
committed
Merge #10502: scripted-diff: Remove BOOST_FOREACH, Q_FOREACH and PAIRTYPE
1238f13 scripted-diff: Remove PAIRTYPE (Jorge Timón) 18dc3c3 scripted-diff: Remove Q_FOREACH (Jorge Timón) 7c00c26 scripted-diff: Fully remove BOOST_FOREACH (Jorge Timón) a5410ac Small preparations for Q_FOREACH, PAIRTYPE and #include <boost/foreach.hpp> removal (Jorge Timón) Tree-SHA512: d3ab4a173366402e7dcef31608977b757d4aa07abbbad2ee1bcbcfa311e994a4552f24e5a55272cb22c2dcf89a4b0495e02e9d9aceae4b08c0bab668f20e324c
2 parents fbf5d3b + 1238f13 commit 1ad3d4e

Some content is hidden

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

63 files changed

+296
-300
lines changed

src/bench/coin_selection.cpp

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
636636
ProduceSignature(MutableTransactionSignatureCreator(&keystore, &mergedTx, i, amount, nHashType), prevPubKey, sigdata);
637637

638638
// ... and merge in other signatures:
639-
BOOST_FOREACH(const CTransaction& txv, txVariants)
639+
for (const CTransaction& txv : txVariants)
640640
sigdata = CombineSignatures(prevPubKey, MutableTransactionSignatureChecker(&mergedTx, i, amount), sigdata, DataFromTransaction(txv, i));
641641
UpdateTransaction(mergedTx, i, sigdata);
642642

src/bloom.cpp

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class CCheckQueue
120120
fOk = fAllOk;
121121
}
122122
// execute work
123-
BOOST_FOREACH (T& check, vChecks)
123+
for (T& check : vChecks)
124124
if (fOk)
125125
fOk = check();
126126
vChecks.clear();
@@ -150,7 +150,7 @@ class CCheckQueue
150150
void Add(std::vector<T>& vChecks)
151151
{
152152
boost::unique_lock<boost::mutex> lock(mutex);
153-
BOOST_FOREACH (T& check, vChecks) {
153+
for (T& check : vChecks) {
154154
queue.push_back(T());
155155
check.swap(queue.back());
156156
}

src/core_write.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
139139
out.pushKV("type", GetTxnOutputType(type));
140140

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

src/httprpc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <stdio.h>
1919

2020
#include <boost/algorithm/string.hpp> // boost::trim
21-
#include <boost/foreach.hpp> //BOOST_FOREACH
21+
#include <boost/foreach.hpp>
2222

2323
/** WWW-Authenticate to present with 401 Unauthorized response */
2424
static const char* WWW_AUTH_HEADER_DATA = "Basic realm=\"jsonrpc\"";
@@ -94,7 +94,7 @@ static bool multiUserAuthorized(std::string strUserPass)
9494

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

src/init.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ void CleanupBlockRevFiles()
613613
// keeping a separate counter. Once we hit a gap (or if 0 doesn't exist)
614614
// start removing block files.
615615
int nContigCounter = 0;
616-
BOOST_FOREACH(const PAIRTYPE(std::string, fs::path)& item, mapBlockFiles) {
616+
for (const std::pair<std::string, fs::path>& item : mapBlockFiles) {
617617
if (atoi(item.first) == nContigCounter) {
618618
nContigCounter++;
619619
continue;
@@ -666,7 +666,7 @@ void ThreadImport(std::vector<fs::path> vImportFiles)
666666
}
667667

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

12761276
if (gArgs.IsArgSet("-onlynet")) {
12771277
std::set<enum Network> nets;
1278-
BOOST_FOREACH(const std::string& snet, gArgs.GetArgs("-onlynet")) {
1278+
for (const std::string& snet : gArgs.GetArgs("-onlynet")) {
12791279
enum Network net = ParseNetwork(snet);
12801280
if (net == NET_UNROUTABLE)
12811281
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet));
@@ -1289,7 +1289,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
12891289
}
12901290

12911291
if (gArgs.IsArgSet("-whitelist")) {
1292-
BOOST_FOREACH(const std::string& net, gArgs.GetArgs("-whitelist")) {
1292+
for (const std::string& net : gArgs.GetArgs("-whitelist")) {
12931293
CSubNet subnet;
12941294
LookupSubNet(net.c_str(), subnet);
12951295
if (!subnet.IsValid())
@@ -1351,15 +1351,15 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
13511351
if (fListen) {
13521352
bool fBound = false;
13531353
if (gArgs.IsArgSet("-bind")) {
1354-
BOOST_FOREACH(const std::string& strBind, gArgs.GetArgs("-bind")) {
1354+
for (const std::string& strBind : gArgs.GetArgs("-bind")) {
13551355
CService addrBind;
13561356
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false))
13571357
return InitError(ResolveErrMsg("bind", strBind));
13581358
fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR));
13591359
}
13601360
}
13611361
if (gArgs.IsArgSet("-whitebind")) {
1362-
BOOST_FOREACH(const std::string& strBind, gArgs.GetArgs("-whitebind")) {
1362+
for (const std::string& strBind : gArgs.GetArgs("-whitebind")) {
13631363
CService addrBind;
13641364
if (!Lookup(strBind.c_str(), addrBind, 0, false))
13651365
return InitError(ResolveErrMsg("whitebind", strBind));
@@ -1379,7 +1379,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
13791379
}
13801380

13811381
if (gArgs.IsArgSet("-externalip")) {
1382-
BOOST_FOREACH(const std::string& strAddr, gArgs.GetArgs("-externalip")) {
1382+
for (const std::string& strAddr : gArgs.GetArgs("-externalip")) {
13831383
CService addrLocal;
13841384
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
13851385
AddLocal(addrLocal, LOCAL_MANUAL);
@@ -1618,7 +1618,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
16181618
std::vector<fs::path> vImportFiles;
16191619
if (gArgs.IsArgSet("-loadblock"))
16201620
{
1621-
BOOST_FOREACH(const std::string& strFile, gArgs.GetArgs("-loadblock"))
1621+
for (const std::string& strFile : gArgs.GetArgs("-loadblock"))
16221622
vImportFiles.push_back(strFile);
16231623
}
16241624

src/miner.cpp

Lines changed: 3 additions & 3 deletions
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)