mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
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-
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user