summaryrefslogtreecommitdiff
path: root/pimd/pim_rp.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-03-31 16:43:36 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-03-31 16:47:00 -0400
commitff3745c26abdfbebeebf14ffe55361666771e1a7 (patch)
treeff24d60ebc1aaca943a3110ef9908e4b4c5863ee /pimd/pim_rp.c
parent8cb129e9868eb5edb7bfe98917fad9931de6144b (diff)
pimd: Remove impossible conditions from test
It is impossible for the list->cmp function to ever be handed NULL values as the arguments. Clean up this in the code. Additionally consolidate the exact same two functions into 1 function. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_rp.c')
-rw-r--r--pimd/pim_rp.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c
index 6c83811d9a..78bbd14405 100644
--- a/pimd/pim_rp.c
+++ b/pimd/pim_rp.c
@@ -54,21 +54,12 @@ pim_rp_info_free (struct rp_info *rp_info)
XFREE (MTYPE_PIM_RP, rp_info);
}
-static int
+int
pim_rp_list_cmp (void *v1, void *v2)
{
struct rp_info *rp1 = (struct rp_info *)v1;
struct rp_info *rp2 = (struct rp_info *)v2;
- if (rp1 == rp2)
- return 0;
-
- if (!rp1 && rp2)
- return -1;
-
- if (rp1 && !rp2)
- return 1;
-
/*
* Sort by RP IP address
*/
@@ -87,10 +78,7 @@ pim_rp_list_cmp (void *v1, void *v2)
if (rp1->group.u.prefix4.s_addr > rp2->group.u.prefix4.s_addr)
return 1;
- if (rp1 == tail)
- return 1;
-
- return -1;
+ return 0;
}
void