Auto merge of #3050 - bitcartel:cleanup_define_X, r=daira

Code clean up. Remove use of X macro.

Closes #3049
This commit is contained in:
Homu 2018-03-08 03:19:29 -08:00
commit d88a12262c
1 changed files with 13 additions and 16 deletions

View File

@ -535,24 +535,22 @@ void CNode::AddWhitelistedRange(const CSubNet &subnet) {
vWhitelistedRange.push_back(subnet); vWhitelistedRange.push_back(subnet);
} }
#undef X
#define X(name) stats.name = name
void CNode::copyStats(CNodeStats &stats) void CNode::copyStats(CNodeStats &stats)
{ {
stats.nodeid = this->GetId(); stats.nodeid = this->GetId();
X(nServices); stats.nServices = nServices;
X(nLastSend); stats.nLastSend = nLastSend;
X(nLastRecv); stats.nLastRecv = nLastRecv;
X(nTimeConnected); stats.nTimeConnected = nTimeConnected;
X(nTimeOffset); stats.nTimeOffset = nTimeOffset;
X(addrName); stats.addrName = addrName;
X(nVersion); stats.nVersion = nVersion;
X(cleanSubVer); stats.cleanSubVer = cleanSubVer;
X(fInbound); stats.fInbound = fInbound;
X(nStartingHeight); stats.nStartingHeight = nStartingHeight;
X(nSendBytes); stats.nSendBytes = nSendBytes;
X(nRecvBytes); stats.nRecvBytes = nRecvBytes;
X(fWhitelisted); stats.fWhitelisted = fWhitelisted;
// It is common for nodes with good ping times to suddenly become lagged, // It is common for nodes with good ping times to suddenly become lagged,
// due to a new block arriving or other large transfer. // due to a new block arriving or other large transfer.
@ -572,7 +570,6 @@ void CNode::copyStats(CNodeStats &stats)
// Leave string empty if addrLocal invalid (not filled in yet) // Leave string empty if addrLocal invalid (not filled in yet)
stats.addrLocal = addrLocal.IsValid() ? addrLocal.ToString() : ""; stats.addrLocal = addrLocal.IsValid() ? addrLocal.ToString() : "";
} }
#undef X
// requires LOCK(cs_vRecvMsg) // requires LOCK(cs_vRecvMsg)
bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes) bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes)