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) @@ -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 nLen = 0;
loop
while (true)
{
string str;
std::getline(stream, str);

4
src/main.cpp

@ -4615,7 +4615,7 @@ void static BitcoinMiner(CWallet *pwallet) @@ -4615,7 +4615,7 @@ void static BitcoinMiner(CWallet *pwallet)
CReserveKey reservekey(pwallet);
unsigned int nExtraNonce = 0;
try { loop {
try { while (true) {
if (Params().NetworkID() != CChainParams::REGTEST) {
// 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.
@ -4659,7 +4659,7 @@ void static BitcoinMiner(CWallet *pwallet) @@ -4659,7 +4659,7 @@ void static BitcoinMiner(CWallet *pwallet)
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
uint256 hashbuf[2];
uint256& hash = *alignup<16>(hashbuf);
loop
while (true)
{
unsigned int nHashesDone = 0;
unsigned int nNonceFound;

12
src/net.cpp

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

1
src/qt/bitcoin.cpp

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

1
src/qt/bitcoingui.cpp

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

1
src/qt/guiutil.cpp

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

1
src/qt/paymentserver.cpp

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

1
src/qt/splashscreen.cpp

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

2
src/script.cpp

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

8
src/util.cpp

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

1
src/util.h

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

2
src/wallet.cpp

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

4
src/walletdb.cpp

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

Loading…
Cancel
Save