-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix modernize-use-nullptr warning reported by clang-tidy #1156
Fix modernize-use-nullptr warning reported by clang-tidy #1156
Conversation
src/types/geohash.cc
Outdated
@@ -166,7 +166,7 @@ void geohashGetCoordRange(GeoHashRange *long_range, GeoHashRange *lat_range) { | |||
int geohashEncode(const GeoHashRange *long_range, const GeoHashRange *lat_range, double longitude, double latitude, | |||
uint8_t step, GeoHashBits *hash) { | |||
/* Check basic arguments sanity. */ | |||
if (hash == NULL || step > 32 || step == 0 || RANGEPISZERO(lat_range) || RANGEPISZERO(long_range)) return 0; | |||
if (hash == nullptr || step > 32 || step == 0 || RANGEPISZERO(lat_range) || RANGEPISZERO(long_range)) return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can go further an replace hash == nullptr
with !hash
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced
src/types/geohash.cc
Outdated
@@ -203,7 +203,7 @@ int geohashEncodeWGS84(double longitude, double latitude, uint8_t step, GeoHashB | |||
|
|||
int geohashDecode(const GeoHashRange &long_range, const GeoHashRange &lat_range, const GeoHashBits &hash, | |||
GeoHashArea *area) { | |||
if (HASHISZERO(hash) || NULL == area || RANGEISZERO(lat_range) || RANGEISZERO(long_range)) { | |||
if (HASHISZERO(hash) || nullptr == area || RANGEISZERO(lat_range) || RANGEISZERO(long_range)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the same trick here: nullptr == area
=> !area
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@MaximSmolskiy Thank you for your contribution.
Thanks all, merging... |
Fix #1100