Skip to content

zebra: remove unused snprintf#22451

Merged
riw777 merged 1 commit into
FRRouting:masterfrom
iurmanj6WIND:fix-aa300791cac4
Jun 23, 2026
Merged

zebra: remove unused snprintf#22451
riw777 merged 1 commit into
FRRouting:masterfrom
iurmanj6WIND:fix-aa300791cac4

Conversation

@iurmanj6WIND

Copy link
Copy Markdown
Contributor

Commit aa30079 ("zebra: convert zebra_neigh hashes to typesafe") replaced a call to zebra_neigh_db_create() by zebra_neigh_db_init(). As a result, the last snprintf becomes useless. Let's remove it.

Commit aa30079 ("zebra: convert `zebra_neigh` hashes to typesafe")
replaced a call to zebra_neigh_db_create() by zebra_neigh_db_init().
As a result, the last `snprintf` becomes useless. Let's remove it.

Signed-off-by: Justin Iurman <justin.iurman@6wind.com>
@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown

Greptile Summary

Removes a dead snprintf call in zebra_evpn_add() that populated a buffer string used solely to name the neighbor hash table. A previous commit (aa30079) replaced zebra_neigh_db_create(buffer) with zebra_neigh_db_init(zevpn->neigh_table), which takes no name argument, leaving the snprintf result unread.

  • The removed line formatted \"Zebra EVPN Neighbor Table vni: %u\" into buffer, which is now only consumed by zebra_mac_db_create(buffer) on the line above — that remaining snprintf at line 1054 is still correct and untouched.
  • The change has no functional impact; it is purely a dead-code cleanup.

Confidence Score: 5/5

Safe to merge — removes a single unreachable snprintf with no side effects.

The deleted line wrote into a local stack buffer that was never subsequently read; the zebra_neigh_db_init call that replaced the old zebra_neigh_db_create(buffer) takes no name argument. The only other consumer of buffer in the same function is the MAC-table snprintf on the line immediately above, which is untouched. There is no functional change and no risk of regression.

No files require special attention.

Important Files Changed

Filename Overview
zebra/zebra_evpn.c Removes one unused snprintf call; the remaining snprintf for the MAC table is unaffected and correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[zebra_evpn_add] --> B["snprintf buffer\nZebra EVPN MAC Table vni"]
    B --> C[zebra_mac_db_create buffer]
    C --> F[zevpn->mac_table]
    A --> D["snprintf buffer (REMOVED)\nZebra EVPN Neighbor Table vni\nwas unused after db_init migration"]
    style D stroke-dasharray: 5 5
    A --> E["zebra_neigh_db_init\nno name arg needed"]
    E --> G[zevpn->neigh_table]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[zebra_evpn_add] --> B["snprintf buffer\nZebra EVPN MAC Table vni"]
    B --> C[zebra_mac_db_create buffer]
    C --> F[zevpn->mac_table]
    A --> D["snprintf buffer (REMOVED)\nZebra EVPN Neighbor Table vni\nwas unused after db_init migration"]
    style D stroke-dasharray: 5 5
    A --> E["zebra_neigh_db_init\nno name arg needed"]
    E --> G[zevpn->neigh_table]
Loading

Reviews (1): Last reviewed commit: "zebra: remove unused snprintf" | Re-trigger Greptile

@riw777 riw777 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good

@riw777 riw777 merged commit 136a319 into FRRouting:master Jun 23, 2026
24 checks passed
@iurmanj6WIND iurmanj6WIND deleted the fix-aa300791cac4 branch June 23, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants