Skip to content
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

Cleanup: nullptr and boolean literals instead of NULL, 0 or 1 #9377

Merged
merged 6 commits into from Jun 17, 2021

Conversation

rubidium42
Copy link
Contributor

Motivation / Problem

Inconsistent nullptr usage, or lack thereof in some places where it still used NULL or 0.
Inconsistent boolean usage, where it would use 0 or 1 to denote false or true.

Description

Mostly the result of some experimentation with clang-tidy.
Next to nullptr and boolean literals, also some simplifications of boolean logic, e.g. e?true:false -> e != 0.
Also a duplicate set of lines between both base_station_base.h and station_base.h was removed from the latter, as the latter already includes the former.

Limitations

Have checked only code that was compiled by clang on my computer, so there might be other places.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@LordAro
Copy link
Member

LordAro commented Jun 17, 2021

I feel like squirrel was left alone on purpose during the 'main' NULL -> nullptr conversion. Not that it particularly matters, it's so custom at this point that any upstream changes are infeasible anyway...

@rubidium42 rubidium42 merged commit 281a65b into OpenTTD:master Jun 17, 2021
@rubidium42 rubidium42 deleted the misc_cleanups branch June 17, 2021 14:18
@rubidium42 rubidium42 restored the misc_cleanups branch June 17, 2021 16:01
@rubidium42 rubidium42 deleted the misc_cleanups branch June 17, 2021 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants