diff options
| author | Wladimir J. van der Laan <[email protected]> | 2017-08-14 16:20:49 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2017-08-14 16:30:59 +0200 |
| commit | ce74799a3c21355b35fed923106d13a0f8133721 (patch) | |
| tree | d3ec5179bb80481b599d18c9b7eb08aaafc3f2d2 /src/dbwrapper.cpp | |
| parent | Merge #11012: Make sure to clean up mapBlockSource if we've already seen the ... (diff) | |
| parent | scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal in... (diff) | |
| download | discoin-ce74799a3c21355b35fed923106d13a0f8133721.tar.xz discoin-ce74799a3c21355b35fed923106d13a0f8133721.zip | |
Merge #10483: scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL
90d4d89 scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL (practicalswift)
Pull request description:
Since C++11 the macro `NULL` may be:
* an integer literal with value zero, or
* a prvalue of type `std::nullptr_t`
By using the C++11 keyword `nullptr` we are guaranteed a prvalue of type `std::nullptr_t`.
For a more thorough discussion, see "A name for the null pointer: nullptr" (Sutter &
Stroustrup), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
With this patch applied there are no `NULL` macro usages left in the repo:
```
$ git grep NULL -- "*.cpp" "*.h" | egrep -v '(/univalue/|/secp256k1/|/leveldb/|_NULL|NULLDUMMY|torcontrol.*NULL|NULL cert)' | wc -l
0
```
The road towards `nullptr` (C++11) is split into two PRs:
* `NULL` → `nullptr` is handled in PR #10483 (scripted, this PR)
* `0` → `nullptr` is handled in PR #10645 (manual)
Tree-SHA512: 3c395d66f2ad724a8e6fed74b93634de8bfc0c0eafac94e64e5194c939499fefd6e68f047de3083ad0b4eff37df9a8a3a76349aa17d55eabbd8e0412f140a297
Diffstat (limited to 'src/dbwrapper.cpp')
| -rw-r--r-- | src/dbwrapper.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index 3626e0177..27767f90b 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -92,7 +92,7 @@ static leveldb::Options GetOptions(size_t nCacheSize) CDBWrapper::CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory, bool fWipe, bool obfuscate) { - penv = NULL; + penv = nullptr; readoptions.verify_checksums = true; iteroptions.verify_checksums = true; iteroptions.fill_cache = false; @@ -144,15 +144,15 @@ CDBWrapper::CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory, bo CDBWrapper::~CDBWrapper() { delete pdb; - pdb = NULL; + pdb = nullptr; delete options.filter_policy; - options.filter_policy = NULL; + options.filter_policy = nullptr; delete options.info_log; - options.info_log = NULL; + options.info_log = nullptr; delete options.block_cache; - options.block_cache = NULL; + options.block_cache = nullptr; delete penv; - options.env = NULL; + options.env = nullptr; } bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync) |