diff --git a/src/init.cpp b/src/init.cpp index 2c1f93727e..5f50f70ac5 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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; - for (const PAIRTYPE(std::string, fs::path)& item : mapBlockFiles) { + for (const std::pair& item : mapBlockFiles) { if (atoi(item.first) == nContigCounter) { nContigCounter++; continue; diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 967933abf4..d3ad24da01 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -81,7 +81,7 @@ public: cachedAddressTable.clear(); { LOCK(wallet->cs_wallet); - for (const PAIRTYPE(CTxDestination, CAddressBookData)& item : wallet->mapAddressBook) + for (const std::pair& item : wallet->mapAddressBook) { const CBitcoinAddress& address = item.first; bool fMine = IsMine(*wallet, address.Get()); diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 6029260426..6025a74096 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -628,7 +628,7 @@ void CoinControlDialog::updateView() std::map > mapCoins; model->listCoins(mapCoins); - for (const PAIRTYPE(QString, std::vector)& coins : mapCoins) { + for (const std::pair>& coins : mapCoins) { CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem(); itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); QString sWalletAddress = coins.first; diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index cb771e839d..132ee32748 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -555,7 +555,7 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen QList > sendingTos = request.getPayTo(); QStringList addresses; - for (const PAIRTYPE(CScript, CAmount)& sendingTo : sendingTos) { + for (const std::pair& sendingTo : sendingTos) { // Extract and check destination addresses CTxDestination dest; if (ExtractDestination(sendingTo.first, dest)) { diff --git a/src/qt/test/paymentservertests.cpp b/src/qt/test/paymentservertests.cpp index e812c5c388..b9a8ad6e28 100644 --- a/src/qt/test/paymentservertests.cpp +++ b/src/qt/test/paymentservertests.cpp @@ -196,7 +196,7 @@ void PaymentServerTests::paymentServerTests() QVERIFY(r.paymentRequest.IsInitialized()); // Extract address and amount from the request QList > sendingTos = r.paymentRequest.getPayTo(); - for (const PAIRTYPE(CScript, CAmount)& sendingTo : sendingTos) { + for (const std::pair& sendingTo : sendingTos) { CTxDestination dest; if (ExtractDestination(sendingTo.first, dest)) QCOMPARE(PaymentServer::verifyAmount(sendingTo.second), false); diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index 3b7a0a9479..bcacc47ef3 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -245,14 +245,14 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco strHTML += "" + tr("Output index") + ": " + QString::number(rec->getOutputIndex()) + "
"; // Message from normal bitcoin:URI (bitcoin:123...?message=example) - for (const PAIRTYPE(std::string, std::string)& r : wtx.vOrderForm) + for (const std::pair& r : wtx.vOrderForm) if (r.first == "Message") strHTML += "
" + tr("Message") + ":
" + GUIUtil::HtmlEscape(r.second, true) + "
"; // // PaymentRequest info: // - for (const PAIRTYPE(std::string, std::string)& r : wtx.vOrderForm) + for (const std::pair& r : wtx.vOrderForm) { if (r.first == "PaymentRequest") { diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 407fef14cc..874311ec5a 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1256,7 +1256,7 @@ UniValue getchaintips(const JSONRPCRequest& request) std::set setOrphans; std::set setPrevs; - for (const PAIRTYPE(const uint256, CBlockIndex*)& item : mapBlockIndex) + for (const std::pair& item : mapBlockIndex) { if (!chainActive.Contains(item.second)) { setOrphans.insert(item.second); diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 1364ff9900..d6f9f0059c 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -474,7 +474,7 @@ UniValue getnetworkinfo(const JSONRPCRequest& request) UniValue localAddresses(UniValue::VARR); { LOCK(cs_mapLocalHost); - for (const PAIRTYPE(CNetAddr, LocalServiceInfo) &item : mapLocalHost) + for (const std::pair &item : mapLocalHost) { UniValue rec(UniValue::VOBJ); rec.push_back(Pair("address", item.first.ToString())); diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 48b2e4c274..a6d7d1a86f 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -186,7 +186,7 @@ std::string CRPCTable::help(const std::string& strCommand, const JSONRPCRequest& jreq.fHelp = true; jreq.params = UniValue(); - for (const PAIRTYPE(std::string, const CRPCCommand*)& command : vCommands) + for (const std::pair& command : vCommands) { const CRPCCommand *pcmd = command.second; std::string strMethod = pcmd->name; diff --git a/src/script/standard.cpp b/src/script/standard.cpp index 85b33778b7..7efcad7b0f 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -94,7 +94,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector& tplate : mTemplates) { const CScript& script2 = tplate.second; vSolutionsRet.clear(); diff --git a/src/sync.cpp b/src/sync.cpp index d32202b701..94f2cafa98 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -77,7 +77,7 @@ static void potential_deadlock_detected(const std::pair& mismatch, { LogPrintf("POTENTIAL DEADLOCK DETECTED\n"); LogPrintf("Previous lock order was:\n"); - for (const PAIRTYPE(void*, CLockLocation) & i : s2) { + for (const std::pair & i : s2) { if (i.first == mismatch.first) { LogPrintf(" (1)"); } @@ -87,7 +87,7 @@ static void potential_deadlock_detected(const std::pair& mismatch, LogPrintf(" %s\n", i.second.ToString()); } LogPrintf("Current lock order is:\n"); - for (const PAIRTYPE(void*, CLockLocation) & i : s1) { + for (const std::pair & i : s1) { if (i.first == mismatch.first) { LogPrintf(" (1)"); } @@ -108,7 +108,7 @@ static void push_lock(void* c, const CLockLocation& locklocation, bool fTry) (*lockstack).push_back(std::make_pair(c, locklocation)); - for (const PAIRTYPE(void*, CLockLocation) & i : (*lockstack)) { + for (const std::pair & i : (*lockstack)) { if (i.first == c) break; @@ -142,14 +142,14 @@ void LeaveCritical() std::string LocksHeld() { std::string result; - for (const PAIRTYPE(void*, CLockLocation) & i : *lockstack) + for (const std::pair & i : *lockstack) result += i.second.ToString() + std::string("\n"); return result; } void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs) { - for (const PAIRTYPE(void*, CLockLocation) & i : *lockstack) + for (const std::pair & i : *lockstack) if (i.first == cs) return; fprintf(stderr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld().c_str()); diff --git a/src/utilstrencodings.h b/src/utilstrencodings.h index 8846cb47ee..8b37fe12e0 100644 --- a/src/utilstrencodings.h +++ b/src/utilstrencodings.h @@ -18,7 +18,6 @@ #define UBEGIN(a) ((unsigned char*)&(a)) #define UEND(a) ((unsigned char*)&((&(a))[1])) #define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0])) -#define PAIRTYPE(t1, t2) std::pair /** Used by SanitizeString() */ enum SafeChars diff --git a/src/validation.cpp b/src/validation.cpp index ddedbdb97d..d07c1437ea 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3300,13 +3300,13 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams) // Calculate nChainWork std::vector > vSortedByHeight; vSortedByHeight.reserve(mapBlockIndex.size()); - for (const PAIRTYPE(uint256, CBlockIndex*)& item : mapBlockIndex) + for (const std::pair& item : mapBlockIndex) { CBlockIndex* pindex = item.second; vSortedByHeight.push_back(std::make_pair(pindex->nHeight, pindex)); } sort(vSortedByHeight.begin(), vSortedByHeight.end()); - for (const PAIRTYPE(int, CBlockIndex*)& item : vSortedByHeight) + for (const std::pair& item : vSortedByHeight) { CBlockIndex* pindex = item.second; pindex->nChainWork = (pindex->pprev ? pindex->pprev->nChainWork : 0) + GetBlockProof(*pindex); @@ -3355,7 +3355,7 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams) // Check presence of blk files LogPrintf("Checking all blk files are present...\n"); std::set setBlkDataFiles; - for (const PAIRTYPE(uint256, CBlockIndex*)& item : mapBlockIndex) + for (const std::pair& item : mapBlockIndex) { CBlockIndex* pindex = item.second; if (pindex->nStatus & BLOCK_HAVE_DATA) { diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index cfc9ee5c1a..f03137216b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -96,7 +96,7 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) } entry.push_back(Pair("bip125-replaceable", rbfStatus)); - for (const PAIRTYPE(std::string, std::string)& item : wtx.mapValue) + for (const std::pair& item : wtx.mapValue) entry.push_back(Pair(item.first, item.second)); } @@ -1673,7 +1673,7 @@ UniValue listaccounts(const JSONRPCRequest& request) mapAccountBalances[entry.strAccount] += entry.nCreditDebit; UniValue ret(UniValue::VOBJ); - for (const PAIRTYPE(std::string, CAmount)& accountBalance : mapAccountBalances) { + for (const std::pair& accountBalance : mapAccountBalances) { ret.push_back(Pair(accountBalance.first, ValueFromAmount(accountBalance.second))); } return ret; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 531a1fabff..e6e14c6c77 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -804,7 +804,7 @@ void CWallet::MarkDirty() { { LOCK(cs_wallet); - for (PAIRTYPE(const uint256, CWalletTx)& item : mapWallet) + for (std::pair& item : mapWallet) item.second.MarkDirty(); } } @@ -1525,7 +1525,7 @@ void CWallet::ReacceptWalletTransactions() std::map mapSorted; // Sort pending wallet transactions based on their initial wallet insertion order - for (PAIRTYPE(const uint256, CWalletTx)& item : mapWallet) + for (std::pair& item : mapWallet) { const uint256& wtxid = item.first; CWalletTx& wtx = item.second; @@ -1539,7 +1539,7 @@ void CWallet::ReacceptWalletTransactions() } // Try to add wallet transactions to memory pool - for (PAIRTYPE(const int64_t, CWalletTx*)& item : mapSorted) + for (std::pair& item : mapSorted) { CWalletTx& wtx = *(item.second); @@ -1796,7 +1796,7 @@ std::vector CWallet::ResendWalletTransactionsBefore(int64_t nTime, CCon LOCK(cs_wallet); // Sort them in chronological order std::multimap mapSorted; - for (PAIRTYPE(const uint256, CWalletTx)& item : mapWallet) + for (std::pair& item : mapWallet) { CWalletTx& wtx = item.second; // Don't rebroadcast if newer than nTime: @@ -1804,7 +1804,7 @@ std::vector CWallet::ResendWalletTransactionsBefore(int64_t nTime, CCon continue; mapSorted.insert(std::make_pair(wtx.nTimeReceived, &wtx)); } - for (PAIRTYPE(const unsigned int, CWalletTx*)& item : mapSorted) + for (std::pair& item : mapSorted) { CWalletTx& wtx = *item.second; if (wtx.RelayWalletTransaction(connman)) @@ -3010,7 +3010,7 @@ bool CWallet::DelAddressBook(const CTxDestination& address) // Delete destdata tuples associated with address std::string strAddress = CBitcoinAddress(address).ToString(); - for (const PAIRTYPE(std::string, std::string) &item : mapAddressBook[address].destdata) + for (const std::pair &item : mapAddressBook[address].destdata) { CWalletDB(*dbw).EraseDestData(strAddress, item.first); } @@ -3388,7 +3388,7 @@ std::set CWallet::GetAccountAddresses(const std::string& strAcco { LOCK(cs_wallet); std::set result; - for (const PAIRTYPE(CTxDestination, CAddressBookData)& item : mapAddressBook) + for (const std::pair& item : mapAddressBook) { const CTxDestination& address = item.first; const std::string& strName = item.second.name;