mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-04 19:08:51 +02:00
Merge #15114: Qt: Replace remaining 0 with nullptr
3a0e76fc12Replace remaining 0 with nullptr in Qt code (Ben Woosley)9096276e0bDon't use zero as null pointer constant (-Wzero-as-null-pointer-constant) (practicalswift) Pull request description: This corrects all violations of `-Wzero-as-null-pointer-constant` identified in the Qt codebase. These changes are extracted from #15112 as suggested by @MarcoFalke to ease review. This is in service of enabling `-Wzero-as-null-pointer-constant`, which should eliminate this as a concern going forward. Note there are 2 non-Qt changes: `src/test/allocator_tests.cpp` and `src/wallet/db.cpp`. Tree-SHA512: 206bd668802147ba42bc413c2d7d259cb59aca9ec1da74a6bf2ca3932e60ae492faacbc61bcee0fd6b4b49a4d59d075b7e5404f0526b36c47718f9b0587e7768
This commit is contained in:
@@ -105,13 +105,13 @@ BOOST_AUTO_TEST_CASE(arena_tests)
|
||||
// Go entirely wild: free and alloc interleaved,
|
||||
// generate targets and sizes using pseudo-randomness.
|
||||
for (int x=0; x<2048; ++x)
|
||||
addr.push_back(0);
|
||||
addr.push_back(nullptr);
|
||||
uint32_t s = 0x12345678;
|
||||
for (int x=0; x<5000; ++x) {
|
||||
int idx = s & (addr.size()-1);
|
||||
if (s & 0x80000000) {
|
||||
b.free(addr[idx]);
|
||||
addr[idx] = 0;
|
||||
addr[idx] = nullptr;
|
||||
} else if(!addr[idx]) {
|
||||
addr[idx] = b.alloc((s >> 16) & 2047);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
|
||||
return reinterpret_cast<void*>(0x08000000 + (count<<24)); // Fake address, do not actually use this memory
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
void FreeLocked(void* addr, size_t len) override
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user