Skip to content

[dhcpmon] Use NULL for DB result pointers - #106

Closed
Xichen96 wants to merge 1 commit into
sonic-net:masterfrom
Xichen96:dev/xichenlin/use-null-for-db-results
Closed

[dhcpmon] Use NULL for DB result pointers#106
Xichen96 wants to merge 1 commit into
sonic-net:masterfrom
Xichen96:dev/xichenlin/use-null-for-db-results

Conversation

@Xichen96

@Xichen96 Xichen96 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description of PR

Replace four nullptr comparisons introduced by merged PR #62 with NULL to
match the existing sonic-dhcpmon pointer style.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation update
  • Test improvement

Approach

What is the motivation for this PR?

The surrounding daemon consistently uses NULL; these four checks were the
remaining style outliers from the DHCPv6 monitoring change.

How did you do it?

Changed only the four CONFIG_DB result pointer comparisons. There is no
behavioral change.

How did you verify/test it?

Azure PR CI only; no local compilation.

Any platform specific information?

No.

Back port request

None. This targets master only.

Documentation

Not applicable.

Review

Review the single commit:

51ba2fd [dhcpmon]: Use NULL for DB result pointers

Align the four DHCPv4/v6 counter initialization checks from PR sonic-net#62 with the daemon's existing pointer style.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 39f979be-d826-4d5c-949a-f20abb58bb83
Signed-off-by: Xichen96 <lukelin0907@gmail.com>
Copilot AI review requested due to automatic review settings July 28, 2026 04:38
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR is a small style-only cleanup in sonic-dhcpmon that aligns CONFIG_DB hget() result pointer checks in the DHCP monitor with the project’s established NULL-based null-check convention.

Changes:

  • Replaced four nullptr comparisons with NULL in db_counters_initialized() for RX/TX counter existence checks (v4 and v6).
  • No behavioral changes intended; only pointer-style consistency.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@Xichen96
Xichen96 marked this pull request as ready for review July 31, 2026 17:58
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@Xichen96

Copy link
Copy Markdown
Contributor Author

Closing because its four nullptr-to-NULL consistency changes are now folded into #96 with the other small hardening cleanups.

@Xichen96 Xichen96 closed this Jul 31, 2026
@Xichen96
Xichen96 deleted the dev/xichenlin/use-null-for-db-results branch July 31, 2026 19:20
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.

3 participants