Skip to content

Commit

Permalink
Remove loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Tranz5 committed May 23, 2014
1 parent 4a83be5 commit 7e19469
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/bitcoinrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ int ReadHTTPStatus(std::basic_istream<char>& stream, int &proto)
int ReadHTTPHeader(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet)
{
int nLen = 0;
loop
while (true)
{
string str;
std::getline(stream, str);
Expand Down Expand Up @@ -943,7 +943,7 @@ void ThreadRPCServer3(void* parg)
AcceptedConnection *conn = (AcceptedConnection *) parg;

bool fRun = true;
loop {
while (true) {
if (fShutdown || !fRun)
{
conn->close();
Expand Down
2 changes: 1 addition & 1 deletion src/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ bool CTxDB::LoadBlockIndexGuts()

// Load mapBlockIndex
unsigned int fFlags = DB_SET_RANGE;
loop
while (true)
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
Expand Down
6 changes: 3 additions & 3 deletions src/irc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static bool Send(SOCKET hSocket, const char* pszSend)

bool RecvLineIRC(SOCKET hSocket, string& strLine)
{
loop
while (true)
{
bool fRet = RecvLine(hSocket, strLine);
if (fRet)
Expand All @@ -100,7 +100,7 @@ bool RecvLineIRC(SOCKET hSocket, string& strLine)

int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL, const char* psz4=NULL)
{
loop
while (true)
{
string strLine;
strLine.reserve(10000);
Expand Down Expand Up @@ -135,7 +135,7 @@ bool Wait(int nSeconds)
bool RecvCodeLine(SOCKET hSocket, const char* psz1, string& strRet)
{
strRet.clear();
loop
while (true)
{
string strLine;
if (!RecvLineIRC(hSocket, strLine))
Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2512,7 +2512,7 @@ static unsigned int nCurrentBlockFile = 1;
FILE* AppendBlockFile(unsigned int& nFileRet)
{
nFileRet = 0;
loop
while (true)
{
FILE* file = OpenBlockFile(nCurrentBlockFile, 0, "ab");
if (!file)
Expand Down Expand Up @@ -3617,7 +3617,7 @@ bool ProcessMessages(CNode* pfrom)
// (x) data
//

loop
while (true)
{
// Don't bother if send buffer is too full to respond anyway
if (pfrom->vSend.size() >= SendBufferSize())
Expand Down Expand Up @@ -4470,7 +4470,7 @@ void BitcoinMiner(CWallet *pwallet, bool fProofOfStake)
block_header res_header;
uint256 result;

loop
while (true)
{
unsigned int nHashesDone = 0;
unsigned int nNonceFound;
Expand Down
14 changes: 7 additions & 7 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,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);
Expand Down Expand Up @@ -316,7 +316,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))
{
Expand Down Expand Up @@ -668,7 +668,7 @@ void ThreadSocketHandler2(void* parg)
list<CNode*> vNodesDisconnected;
unsigned int nPrevNodeCount = 0;

loop
while (true)
{
//
// Disconnect nodes
Expand Down Expand Up @@ -1081,7 +1081,7 @@ void ThreadMapPort2(void* parg)
else
printf("UPnP Port Mapping successful.\n");
int i = 1;
loop {
while (true) {
if (fShutdown || !fUseUPnP)
{
r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0);
Expand Down Expand Up @@ -1116,7 +1116,7 @@ void ThreadMapPort2(void* parg)
freeUPNPDevlist(devlist); devlist = 0;
if (r != 0)
FreeUPNPUrls(&urls);
loop {
while (true) {
if (fShutdown || !fUseUPnP)
return;
Sleep(2000);
Expand Down Expand Up @@ -1352,7 +1352,7 @@ void ThreadOpenConnections2(void* parg)

// Initiate network connections
int64 nStart = GetTime();
loop
while (true)
{
ProcessOneShot();

Expand Down Expand Up @@ -1411,7 +1411,7 @@ void ThreadOpenConnections2(void* parg)
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);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/qtipcserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static void ipcThread2(void* pArg)
size_t nSize = 0;
unsigned int nPriority = 0;

loop
while (true)
{
ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100);
if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d))
Expand Down
2 changes: 1 addition & 1 deletion src/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,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())
{
Expand Down
8 changes: 4 additions & 4 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,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);
Expand Down Expand Up @@ -376,7 +376,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)
Expand Down Expand Up @@ -492,7 +492,7 @@ vector<unsigned char> ParseHex(const char* psz)
{
// convert hex dump to vector
vector<unsigned char> vch;
loop
while (true)
{
while (isspace(*psz))
psz++;
Expand Down Expand Up @@ -994,7 +994,7 @@ string DecodeDumpString(const string &str)

bool WildcardMatch(const char* psz, const char* mask)
{
loop
while (true)
{
switch (*mask)
{
Expand Down
1 change: 0 additions & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ typedef unsigned long long uint64;
static const int64 COIN = 1000000;
static const int64 CENT = 10000;

#define loop for (;;)
#define BEGIN(a) ((char*)&(a))
#define END(a) ((char*)&((&(a))[1]))
#define UBEGIN(a) ((unsigned char*)&(a))
Expand Down
4 changes: 2 additions & 2 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64> >& vecSend, CW
CTxDB txdb("r");
{
nFeeRet = nTransactionFee;
loop
while (true)
{
wtxNew.vin.clear();
wtxNew.vout.clear();
Expand Down Expand Up @@ -1542,7 +1542,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
}

int64 nMinFee = 0;
loop
while (true)
{
// Set output amount
if (txNew.vout.size() == 3)
Expand Down
4 changes: 2 additions & 2 deletions src/walletdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,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);
Expand Down Expand Up @@ -455,7 +455,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
return DB_CORRUPT;
}

loop
while (true)
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
Expand Down

0 comments on commit 7e19469

Please sign in to comment.