Found this lone instance of NULL when adding and updating some older source files to the 0.18 codebase. This appears to be the only instance of NULL still present.
NULL to nullptr #16290
pull Bushstar wants to merge 1 commits into bitcoin:master from Bushstar:null-to-nullptr changing 1 files +1 −1-
Bushstar commented at 9:42 AM on June 26, 2019: contributor
-
NULL to nullptr 2f23034687
- fanquake added the label Refactoring on Jun 26, 2019
-
jonasschnelli commented at 9:47 AM on June 26, 2019: contributor
Meh. Waste of time PR but ACK. Please focus on doing PRs that actually improve things. This looks like an arbitrary NULL->nullptr change without an overall concept.
-
Bushstar commented at 10:16 AM on June 26, 2019: contributor
Yesterday I resisted the urge to remove a redundant semicolon!
I'll hold off such minor changes in future unless they can be incorporated into some larger more productive work.
-
fanquake commented at 10:31 AM on June 26, 2019: member
Thanks, however for the reasons stated above I'm just going to close this.
Yesterday I resisted the urge to remove a redundant semicolon!
Thanks for resisting the urge.
Note: If you ever do happen to open such a PR (applies to all PRs anyways), always try and make it as easy to merge as possible. Set a proper PR title and use a good message. i.e in this case both could just be
refactor: use nullptr instead of NULL in wallet.cpp. - fanquake closed this on Jun 26, 2019
-
practicalswift commented at 3:25 PM on June 26, 2019: contributor
A one-off change like this is temporary in that someone is likely to accidentally use
NULLinstead ofnullptragain in the future.Thus the change is temporary.
Try thinking about how one would make change permanent instead.
That is instead of fixing this specific instance: fix the entire class and thus all future instances.
In this case it could easily be linted away using
git grep:$ git grep "[^A-Z_]NULL[^A-Z_]" -- "*.cpp" "*.h" ":(exclude)src/leveldb/" ":(exclude)src/secp256k1/" ":(exclude)src/univalue/" ":(exclude)*torcontrol*" | grep -vE "//.*NULL" src/wallet/wallet.cpp: return NULL;Personally I would rather see one permanent linter PR than an infinite stream of temporary fixes :-)
You can see how the other linters are implemented in
test/lint/.You could try building a
NULL-linter by looking howtest/lint/lint-assertions.shis implemented. - DrahtBot locked this on Dec 16, 2021