Skip to content

Commit

Permalink
scripted-diff: Fully remove BOOST_FOREACH
Browse files Browse the repository at this point in the history
-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-
  • Loading branch information
jtimon committed Jun 5, 2017
1 parent a5410ac commit 7c00c26
Show file tree
Hide file tree
Showing 49 changed files with 266 additions and 266 deletions.
2 changes: 1 addition & 1 deletion src/bench/coin_selection.cpp
Expand Up @@ -39,7 +39,7 @@ static void CoinSelection(benchmark::State& state)

while (state.KeepRunning()) {
// Empty wallet.
BOOST_FOREACH (COutput output, vCoins)
for (COutput output : vCoins)
delete output.tx;
vCoins.clear();

Expand Down
2 changes: 1 addition & 1 deletion src/bitcoin-tx.cpp
Expand Up @@ -611,7 +611,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
ProduceSignature(MutableTransactionSignatureCreator(&keystore, &mergedTx, i, amount, nHashType), prevPubKey, sigdata);

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

Expand Down
2 changes: 1 addition & 1 deletion src/bloom.cpp
Expand Up @@ -179,7 +179,7 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx)
if (fFound)
return true;

BOOST_FOREACH(const CTxIn& txin, tx.vin)
for (const CTxIn& txin : tx.vin)
{
// Match if the filter contains an outpoint tx spends
if (contains(txin.prevout))
Expand Down
4 changes: 2 additions & 2 deletions src/checkqueue.h
Expand Up @@ -121,7 +121,7 @@ class CCheckQueue
fOk = fAllOk;
}
// execute work
BOOST_FOREACH (T& check, vChecks)
for (T& check : vChecks)
if (fOk)
fOk = check();
vChecks.clear();
Expand Down Expand Up @@ -151,7 +151,7 @@ class CCheckQueue
void Add(std::vector<T>& vChecks)
{
boost::unique_lock<boost::mutex> lock(mutex);
BOOST_FOREACH (T& check, vChecks) {
for (T& check : vChecks) {
queue.push_back(T());
check.swap(queue.back());
}
Expand Down
2 changes: 1 addition & 1 deletion src/core_write.cpp
Expand Up @@ -141,7 +141,7 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
out.pushKV("type", GetTxnOutputType(type));

UniValue a(UniValue::VARR);
BOOST_FOREACH(const CTxDestination& addr, addresses)
for (const CTxDestination& addr : addresses)
a.push_back(CBitcoinAddress(addr).ToString());
out.pushKV("addresses", a);
}
Expand Down
2 changes: 1 addition & 1 deletion src/httprpc.cpp
Expand Up @@ -95,7 +95,7 @@ static bool multiUserAuthorized(std::string strUserPass)

if (gArgs.IsArgSet("-rpcauth")) {
//Search for multi-user login/pass "rpcauth" from config
BOOST_FOREACH(std::string strRPCAuth, gArgs.GetArgs("-rpcauth"))
for (std::string strRPCAuth : gArgs.GetArgs("-rpcauth"))
{
std::vector<std::string> vFields;
boost::split(vFields, strRPCAuth, boost::is_any_of(":$"));
Expand Down
18 changes: 9 additions & 9 deletions src/init.cpp
Expand Up @@ -611,7 +611,7 @@ void CleanupBlockRevFiles()
// keeping a separate counter. Once we hit a gap (or if 0 doesn't exist)
// start removing block files.
int nContigCounter = 0;
BOOST_FOREACH(const PAIRTYPE(std::string, fs::path)& item, mapBlockFiles) {
for (const PAIRTYPE(std::string, fs::path)& item : mapBlockFiles) {
if (atoi(item.first) == nContigCounter) {
nContigCounter++;
continue;
Expand Down Expand Up @@ -664,7 +664,7 @@ void ThreadImport(std::vector<fs::path> vImportFiles)
}

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

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

if (gArgs.IsArgSet("-whitelist")) {
BOOST_FOREACH(const std::string& net, gArgs.GetArgs("-whitelist")) {
for (const std::string& net : gArgs.GetArgs("-whitelist")) {
CSubNet subnet;
LookupSubNet(net.c_str(), subnet);
if (!subnet.IsValid())
Expand Down Expand Up @@ -1349,15 +1349,15 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
if (fListen) {
bool fBound = false;
if (gArgs.IsArgSet("-bind")) {
BOOST_FOREACH(const std::string& strBind, gArgs.GetArgs("-bind")) {
for (const std::string& strBind : gArgs.GetArgs("-bind")) {
CService addrBind;
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false))
return InitError(ResolveErrMsg("bind", strBind));
fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR));
}
}
if (gArgs.IsArgSet("-whitebind")) {
BOOST_FOREACH(const std::string& strBind, gArgs.GetArgs("-whitebind")) {
for (const std::string& strBind : gArgs.GetArgs("-whitebind")) {
CService addrBind;
if (!Lookup(strBind.c_str(), addrBind, 0, false))
return InitError(ResolveErrMsg("whitebind", strBind));
Expand All @@ -1377,7 +1377,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
}

if (gArgs.IsArgSet("-externalip")) {
BOOST_FOREACH(const std::string& strAddr, gArgs.GetArgs("-externalip")) {
for (const std::string& strAddr : gArgs.GetArgs("-externalip")) {
CService addrLocal;
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
AddLocal(addrLocal, LOCAL_MANUAL);
Expand Down Expand Up @@ -1616,7 +1616,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
std::vector<fs::path> vImportFiles;
if (gArgs.IsArgSet("-loadblock"))
{
BOOST_FOREACH(const std::string& strFile, gArgs.GetArgs("-loadblock"))
for (const std::string& strFile : gArgs.GetArgs("-loadblock"))
vImportFiles.push_back(strFile);
}

Expand Down
6 changes: 3 additions & 3 deletions src/miner.cpp
Expand Up @@ -242,7 +242,7 @@ bool BlockAssembler::TestPackage(uint64_t packageSize, int64_t packageSigOpsCost
bool BlockAssembler::TestPackageTransactions(const CTxMemPool::setEntries& package)
{
uint64_t nPotentialBlockSize = nBlockSize; // only used with fNeedSizeAccounting
BOOST_FOREACH (const CTxMemPool::txiter it, package) {
for (const CTxMemPool::txiter it : package) {
if (!IsFinalTx(it->GetTx(), nHeight, nLockTimeCutoff))
return false;
if (!fIncludeWitness && it->GetTx().HasWitness())
Expand Down Expand Up @@ -284,11 +284,11 @@ int BlockAssembler::UpdatePackagesForAdded(const CTxMemPool::setEntries& already
indexed_modified_transaction_set &mapModifiedTx)
{
int nDescendantsUpdated = 0;
BOOST_FOREACH(const CTxMemPool::txiter it, alreadyAdded) {
for (const CTxMemPool::txiter it : alreadyAdded) {
CTxMemPool::setEntries descendants;
mempool.CalculateDescendants(it, descendants);
// Insert all descendants (not yet in block) into the modified set
BOOST_FOREACH(CTxMemPool::txiter desc, descendants) {
for (CTxMemPool::txiter desc : descendants) {
if (alreadyAdded.count(desc))
continue;
++nDescendantsUpdated;
Expand Down

0 comments on commit 7c00c26

Please sign in to comment.