apple / foundationdb

FoundationDB - the open source, distributed, transactional key-value store
https://apple.github.io/foundationdb/
Apache License 2.0
14.37k stars 1.3k forks source link

Remove unnecessary null pointer checks #3742

Open elfring opened 4 years ago

elfring commented 4 years ago

An extra null pointer check is not needed in functions like the following.

sfc-gh-mpilman commented 4 years ago

You're right. This one typically confuses people (including myself) because calling free(nullptr) is usually not a good idea (the C standard says you're allowed to do that, but often people would redefine free and they might not adhere to the standard).

I will tag this for 7.0. This change is relatively simple, if you want to make a PR we would certainly appreciate it. Otherwise we'll do that as soon as someone has time.

elfring commented 4 years ago

How do you think about to use a development tool like “clang-tidy” for corresponding source code adjustments?

sfc-gh-mpilman commented 4 years ago

this is something we wanted to do for a while. It just has not been prioritized.