Skip to content

refactor(bvar): replace NULL with nullptr#3403

Merged
chenBright merged 1 commit into
apache:masterfrom
darion-yaphet:modernize-bvar-nullptr
Jul 22, 2026
Merged

refactor(bvar): replace NULL with nullptr#3403
chenBright merged 1 commit into
apache:masterfrom
darion-yaphet:modernize-bvar-nullptr

Conversation

@darion-yaphet

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: resolve N/A

Problem Summary:

src/bvar still used the legacy NULL macro for pointer null values. Since bRPC already builds with at least C++11, using nullptr is clearer and type-safe, especially in overloaded calls and pointer comparisons.

What is changed and the side effects?

Changed:

  • Replaced NULL with nullptr across src/bvar headers and implementation files.
  • Updated related comments that referred to returning NULL.
  • Kept the cleanup scoped to bvar sources only.

Side effects:

  • Performance effects: None expected. This is a source-level modernization with no intended runtime behavior change.

  • Breaking backward compatibility: No. nullptr is available under the project’s C++11 baseline.


Check List:

  • Please make sure your changes are compilable.
    • Verified with cmake --build build --target brpc-static -j6.
    • Verified with git diff --check.
    • Verified no NULL tokens remain in src/bvar via rg '\bNULL\b' src/bvar -g '*.{h,cpp}'.
  • When providing us with a new feature, it is best to add related tests.
    • Not applicable; this PR does not add a feature or change behavior.
  • Please follow Contributor Covenant Code of Conduct.

Modernize pointer null literals across bvar sources for C++11
consistency, including pthread APIs and related comments.
@chenBright

Copy link
Copy Markdown
Contributor

Nice job!

I previously submitted a PR (#2786) to refactor all NULL values ​​in the project into nullptr. However, the change was too significant, so it wasn't merged.

I think it could be split into multiple PRs for the refactoring.

@chenBright chenBright left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chenBright
chenBright merged commit e044428 into apache:master Jul 22, 2026
15 checks passed
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.

2 participants