aboutsummaryrefslogtreecommitdiff
path: root/src/chain.cpp
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2017-08-07 07:36:37 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2017-08-07 07:36:37 +0200
commit90d4d89230434493c3b1e9174abed2609ba74cf1 (patch)
tree511237508ac27f66846c0aa9405658b835c9ae43 /src/chain.cpp
parenta9dd11144152bf40fa797cc0b0c8857c03d3ad6a (diff)
downloadbitcoin-90d4d89230434493c3b1e9174abed2609ba74cf1.tar.xz
scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL
-BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
Diffstat (limited to 'src/chain.cpp')
-rw-r--r--src/chain.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/chain.cpp b/src/chain.cpp
index ffd58d471d..47acde882e 100644
--- a/src/chain.cpp
+++ b/src/chain.cpp
@@ -9,7 +9,7 @@
* CChain implementation
*/
void CChain::SetTip(CBlockIndex *pindex) {
- if (pindex == NULL) {
+ if (pindex == nullptr) {
vChain.clear();
return;
}
@@ -49,8 +49,8 @@ CBlockLocator CChain::GetLocator(const CBlockIndex *pindex) const {
}
const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const {
- if (pindex == NULL) {
- return NULL;
+ if (pindex == nullptr) {
+ return nullptr;
}
if (pindex->nHeight > Height())
pindex = pindex->GetAncestor(Height());
@@ -63,7 +63,7 @@ CBlockIndex* CChain::FindEarliestAtLeast(int64_t nTime) const
{
std::vector<CBlockIndex*>::const_iterator lower = std::lower_bound(vChain.begin(), vChain.end(), nTime,
[](CBlockIndex* pBlock, const int64_t& time) -> bool { return pBlock->GetBlockTimeMax() < time; });
- return (lower == vChain.end() ? NULL : *lower);
+ return (lower == vChain.end() ? nullptr : *lower);
}
/** Turn the lowest '1' bit in the binary representation of a number into a '0'. */
@@ -83,14 +83,14 @@ int static inline GetSkipHeight(int height) {
CBlockIndex* CBlockIndex::GetAncestor(int height)
{
if (height > nHeight || height < 0)
- return NULL;
+ return nullptr;
CBlockIndex* pindexWalk = this;
int heightWalk = nHeight;
while (heightWalk > height) {
int heightSkip = GetSkipHeight(heightWalk);
int heightSkipPrev = GetSkipHeight(heightWalk - 1);
- if (pindexWalk->pskip != NULL &&
+ if (pindexWalk->pskip != nullptr &&
(heightSkip == height ||
(heightSkip > height && !(heightSkipPrev < heightSkip - 2 &&
heightSkipPrev >= height)))) {
@@ -150,7 +150,7 @@ int64_t GetBlockProofEquivalentTime(const CBlockIndex& to, const CBlockIndex& fr
}
/** Find the last common ancestor two blocks have.
- * Both pa and pb must be non-NULL. */
+ * Both pa and pb must be non-nullptr. */
const CBlockIndex* LastCommonAncestor(const CBlockIndex* pa, const CBlockIndex* pb) {
if (pa->nHeight > pb->nHeight) {
pa = pa->GetAncestor(pb->nHeight);