Browse Source

Merge pull request #2866 from gavinandresen/loopdefine

Remove #define loop from util.h
0.10
Jeff Garzik 11 years ago
parent
commit
8351d55cd3
  1. 2
      src/bitcoinrpc.cpp
  2. 4
      src/main.cpp
  3. 12
      src/net.cpp
  4. 1
      src/qt/bitcoin.cpp
  5. 1
      src/qt/bitcoingui.cpp
  6. 1
      src/qt/guiutil.cpp
  7. 1
      src/qt/paymentserver.cpp
  8. 1
      src/qt/splashscreen.cpp
  9. 2
      src/script.cpp
  10. 8
      src/util.cpp
  11. 1
      src/util.h
  12. 2
      src/wallet.cpp
  13. 4
      src/walletdb.cpp

2
src/bitcoinrpc.cpp

@ -414,7 +414,7 @@ int ReadHTTPStatus(std::basic_istream<char>& stream, int &proto)
int ReadHTTPHeaders(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet) int ReadHTTPHeaders(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet)
{ {
int nLen = 0; int nLen = 0;
loop while (true)
{ {
string str; string str;
std::getline(stream, str); std::getline(stream, str);

4
src/main.cpp

@ -4615,7 +4615,7 @@ void static BitcoinMiner(CWallet *pwallet)
CReserveKey reservekey(pwallet); CReserveKey reservekey(pwallet);
unsigned int nExtraNonce = 0; unsigned int nExtraNonce = 0;
try { loop { try { while (true) {
if (Params().NetworkID() != CChainParams::REGTEST) { if (Params().NetworkID() != CChainParams::REGTEST) {
// Busy-wait for the network to come online so we don't waste time mining // Busy-wait for the network to come online so we don't waste time mining
// on an obsolete chain. In regtest mode we expect to fly solo. // on an obsolete chain. In regtest mode we expect to fly solo.
@ -4659,7 +4659,7 @@ void static BitcoinMiner(CWallet *pwallet)
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256(); uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
uint256 hashbuf[2]; uint256 hashbuf[2];
uint256& hash = *alignup<16>(hashbuf); uint256& hash = *alignup<16>(hashbuf);
loop while (true)
{ {
unsigned int nHashesDone = 0; unsigned int nHashesDone = 0;
unsigned int nNonceFound; unsigned int nNonceFound;

12
src/net.cpp

@ -129,7 +129,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer)
bool RecvLine(SOCKET hSocket, string& strLine) bool RecvLine(SOCKET hSocket, string& strLine)
{ {
strLine = ""; strLine = "";
loop while (true)
{ {
char c; char c;
int nBytes = recv(hSocket, &c, 1, 0); int nBytes = recv(hSocket, &c, 1, 0);
@ -301,7 +301,7 @@ bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const cha
{ {
if (strLine.empty()) // HTTP response is separated from headers by blank line if (strLine.empty()) // HTTP response is separated from headers by blank line
{ {
loop while (true)
{ {
if (!RecvLine(hSocket, strLine)) if (!RecvLine(hSocket, strLine))
{ {
@ -741,7 +741,7 @@ static list<CNode*> vNodesDisconnected;
void ThreadSocketHandler() void ThreadSocketHandler()
{ {
unsigned int nPrevNodeCount = 0; unsigned int nPrevNodeCount = 0;
loop while (true)
{ {
// //
// Disconnect nodes // Disconnect nodes
@ -1105,7 +1105,7 @@ void ThreadMapPort()
string strDesc = "Bitcoin " + FormatFullVersion(); string strDesc = "Bitcoin " + FormatFullVersion();
try { try {
loop { while (true) {
#ifndef UPNPDISCOVER_SUCCESS #ifndef UPNPDISCOVER_SUCCESS
/* miniupnpc 1.5 */ /* miniupnpc 1.5 */
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
@ -1268,7 +1268,7 @@ void ThreadOpenConnections()
// Initiate network connections // Initiate network connections
int64 nStart = GetTime(); int64 nStart = GetTime();
loop while (true)
{ {
ProcessOneShot(); ProcessOneShot();
@ -1309,7 +1309,7 @@ void ThreadOpenConnections()
int64 nANow = GetAdjustedTime(); int64 nANow = GetAdjustedTime();
int nTries = 0; int nTries = 0;
loop while (true)
{ {
// use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections) // use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections)
CAddress addr = addrman.Select(10 + min(nOutbound,8)*10); CAddress addr = addrman.Select(10 + min(nOutbound,8)*10);

1
src/qt/bitcoin.cpp

@ -15,7 +15,6 @@
#include "splashscreen.h" #include "splashscreen.h"
#include "intro.h" #include "intro.h"
#undef loop /* Todo: ugh, remove this when the #define loop is gone from util.h */
#include <QApplication> #include <QApplication>
#include <QMessageBox> #include <QMessageBox>
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000

1
src/qt/bitcoingui.cpp

@ -28,7 +28,6 @@
#include "macdockiconhandler.h" #include "macdockiconhandler.h"
#endif #endif
#undef loop /* Todo: ugh, remove this when the #define loop is gone from util.h */
#include <QApplication> #include <QApplication>
#include <QMenuBar> #include <QMenuBar>
#include <QMenu> #include <QMenu>

1
src/qt/guiutil.cpp

@ -7,7 +7,6 @@
#include "util.h" #include "util.h"
#include "init.h" #include "init.h"
#undef loop /* Todo: ugh, remove this when the #define loop is gone from util.h */
#include <QApplication> #include <QApplication>
#include <QDateTime> #include <QDateTime>
#include <QDoubleValidator> #include <QDoubleValidator>

1
src/qt/paymentserver.cpp

@ -8,7 +8,6 @@
#include "ui_interface.h" #include "ui_interface.h"
#include "util.h" #include "util.h"
#undef loop /* Todo: ugh, remove this when the #define loop is gone from util.h */
#include <QApplication> #include <QApplication>
#include <QByteArray> #include <QByteArray>
#include <QDataStream> #include <QDataStream>

1
src/qt/splashscreen.cpp

@ -2,7 +2,6 @@
#include "clientversion.h" #include "clientversion.h"
#include "util.h" #include "util.h"
#undef loop /* Todo: ugh, remove this when the #define loop is gone from util.h */
#include <QApplication> #include <QApplication>
#include <QPainter> #include <QPainter>

2
src/script.cpp

@ -1163,7 +1163,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
// Compare // Compare
CScript::const_iterator pc1 = script1.begin(); CScript::const_iterator pc1 = script1.begin();
CScript::const_iterator pc2 = script2.begin(); CScript::const_iterator pc2 = script2.begin();
loop while (true)
{ {
if (pc1 == script1.end() && pc2 == script2.end()) if (pc1 == script1.end() && pc2 == script2.end())
{ {

8
src/util.cpp

@ -311,7 +311,7 @@ string vstrprintf(const char *format, va_list ap)
char* p = buffer; char* p = buffer;
int limit = sizeof(buffer); int limit = sizeof(buffer);
int ret; int ret;
loop while (true)
{ {
va_list arg_ptr; va_list arg_ptr;
va_copy(arg_ptr, ap); va_copy(arg_ptr, ap);
@ -371,7 +371,7 @@ void ParseString(const string& str, char c, vector<string>& v)
return; return;
string::size_type i1 = 0; string::size_type i1 = 0;
string::size_type i2; string::size_type i2;
loop while (true)
{ {
i2 = str.find(c, i1); i2 = str.find(c, i1);
if (i2 == str.npos) if (i2 == str.npos)
@ -487,7 +487,7 @@ vector<unsigned char> ParseHex(const char* psz)
{ {
// convert hex dump to vector // convert hex dump to vector
vector<unsigned char> vch; vector<unsigned char> vch;
loop while (true)
{ {
while (isspace(*psz)) while (isspace(*psz))
psz++; psz++;
@ -941,7 +941,7 @@ string DecodeBase32(const string& str)
bool WildcardMatch(const char* psz, const char* mask) bool WildcardMatch(const char* psz, const char* mask)
{ {
loop while (true)
{ {
switch (*mask) switch (*mask)
{ {

1
src/util.h

@ -35,7 +35,6 @@ typedef unsigned long long uint64;
static const int64 COIN = 100000000; static const int64 COIN = 100000000;
static const int64 CENT = 1000000; static const int64 CENT = 1000000;
#define loop for (;;)
#define BEGIN(a) ((char*)&(a)) #define BEGIN(a) ((char*)&(a))
#define END(a) ((char*)&((&(a))[1])) #define END(a) ((char*)&((&(a))[1]))
#define UBEGIN(a) ((unsigned char*)&(a)) #define UBEGIN(a) ((unsigned char*)&(a))

2
src/wallet.cpp

@ -1194,7 +1194,7 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64> >& vecSend,
LOCK2(cs_main, cs_wallet); LOCK2(cs_main, cs_wallet);
{ {
nFeeRet = nTransactionFee; nFeeRet = nTransactionFee;
loop while (true)
{ {
wtxNew.vin.clear(); wtxNew.vin.clear();
wtxNew.vout.clear(); wtxNew.vout.clear();

4
src/walletdb.cpp

@ -73,7 +73,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin
if (!pcursor) if (!pcursor)
throw runtime_error("CWalletDB::ListAccountCreditDebit() : cannot create DB cursor"); throw runtime_error("CWalletDB::ListAccountCreditDebit() : cannot create DB cursor");
unsigned int fFlags = DB_SET_RANGE; unsigned int fFlags = DB_SET_RANGE;
loop while (true)
{ {
// Read next record // Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssKey(SER_DISK, CLIENT_VERSION);
@ -437,7 +437,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
return DB_CORRUPT; return DB_CORRUPT;
} }
loop while (true)
{ {
// Read next record // Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssKey(SER_DISK, CLIENT_VERSION);

Loading…
Cancel
Save