From b9130ab51b58a87d1c1b0d4e0cab072df1357a4d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 8 Feb 2024 11:49:08 -0500 Subject: [PATCH] zebra: Remove helper function if_nhg_dependents_is_empty Let's just let the function figure this out. Signed-off-by: Donald Sharp --- zebra/interface.c | 12 ------------ zebra/zebra_vty.c | 15 ++++++++------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/zebra/interface.c b/zebra/interface.c index 6624eb2591..829f9dab61 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -983,18 +983,6 @@ unsigned int if_nhg_dependents_count(const struct interface *ifp) return 0; } - -bool if_nhg_dependents_is_empty(const struct interface *ifp) -{ - if (ifp->info) { - struct zebra_if *zif = (struct zebra_if *)ifp->info; - - return nhg_connected_tree_is_empty(&zif->nhg_dependents); - } - - return false; -} - /* Interface is up. */ void if_up(struct interface *ifp, bool install_connected) { diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 70b71fe707..422acf0837 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1476,17 +1476,18 @@ static void if_nexthop_group_dump_vty(struct vty *vty, struct interface *ifp) { struct zebra_if *zebra_if = NULL; struct nhg_connected *rb_node_dep = NULL; + bool first = true; zebra_if = ifp->info; - if (!if_nhg_dependents_is_empty(ifp)) { - vty_out(vty, "Interface %s:\n", ifp->name); - - frr_each(nhg_connected_tree, &zebra_if->nhg_dependents, - rb_node_dep) { - vty_out(vty, " "); - show_nexthop_group_out(vty, rb_node_dep->nhe, NULL); + frr_each (nhg_connected_tree, &zebra_if->nhg_dependents, rb_node_dep) { + if (first) { + vty_out(vty, "Interface %s:\n", ifp->name); + first = false; } + + vty_out(vty, " "); + show_nexthop_group_out(vty, rb_node_dep->nhe, NULL); } } -- 2.39.5