summaryrefslogtreecommitdiffstats
path: root/pimd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-02-18 01:02:55 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-02-23 13:08:36 +0100
commit55cd0f612a046137f0be936e7856921ada4546ca (patch)
tree33ebc2df612fe462d3f422834fe6c99c409320f1 /pimd
parentzebra: On shutdown don't count removals (diff)
downloadfrr-55cd0f612a046137f0be936e7856921ada4546ca.tar.xz
frr-55cd0f612a046137f0be936e7856921ada4546ca.zip
*: Make assignment from RB_ROOT in while loop work better
Fix up the assignment of the variable = RB_ROOT inside of while loop patter we were using. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd')
-rw-r--r--pimd/pim_iface.c12
-rw-r--r--pimd/pim_ifchannel.c5
2 files changed, 11 insertions, 6 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index f02cf7ed3..a807c69c6 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -85,9 +85,11 @@ static void *if_list_clean(struct pim_interface *pim_ifp)
if (pim_ifp->sec_addr_list)
list_delete_and_null(&pim_ifp->sec_addr_list);
- while ((ch = RB_ROOT(pim_ifchannel_rb,
- &pim_ifp->ifchannel_rb)) != NULL)
+ while (!RB_EMPTY(pim_ifchannel_rb, &pim_ifp->ifchannel_rb)) {
+ ch = RB_ROOT(pim_ifchannel_rb, &pim_ifp->ifchannel_rb);
+
pim_ifchannel_delete(ch);
+ }
XFREE(MTYPE_PIM_INTERFACE, pim_ifp);
@@ -250,9 +252,11 @@ void pim_if_delete(struct interface *ifp)
if (pim_ifp->boundary_oil_plist)
XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist);
- while ((ch = RB_ROOT(pim_ifchannel_rb,
- &pim_ifp->ifchannel_rb)) != NULL)
+ while (!RB_EMPTY(pim_ifchannel_rb, &pim_ifp->ifchannel_rb)) {
+ ch = RB_ROOT(pim_ifchannel_rb, &pim_ifp->ifchannel_rb);
+
pim_ifchannel_delete(ch);
+ }
XFREE(MTYPE_PIM_INTERFACE, pim_ifp);
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index 7d3b783ad..4d564e504 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -211,8 +211,9 @@ void pim_ifchannel_delete_all(struct interface *ifp)
if (!pim_ifp)
return;
- while ((ch = RB_ROOT(pim_ifchannel_rb,
- &pim_ifp->ifchannel_rb)) != NULL) {
+ while (!RB_EMPTY(pim_ifchannel_rb, &pim_ifp->ifchannel_rb)) {
+ ch = RB_ROOT(pim_ifchannel_rb, &pim_ifp->ifchannel_rb);
+
pim_ifchannel_delete(ch);
}
}