summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-03-31 12:07:34 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-03-31 14:00:29 -0400
commit974fc9d251d9b940d3e813839603d9946baedd80 (patch)
treefeb0463526a43775ef252a405b5189aab19f4bd7 /lib/if.c
parent6c12c8ab7629d5b1f11595bf779a1ebb5ba09746 (diff)
lib: Combine name comparison function
The vrf name comparison function was the same as the interface comparison function. Combine the forces for the goodness of mankind. Ticket: CM-10184 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/if.c b/lib/if.c
index 443cd419be..420215d8b7 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -57,16 +57,12 @@ struct if_master
* devpty0, de0 < del0
*/
int
-if_cmp_func (struct interface *ifp1, struct interface *ifp2)
+if_cmp_name_func (char *p1, char *p2)
{
unsigned int l1, l2;
long int x1, x2;
- char *p1, *p2;
int res;
- p1 = ifp1->name;
- p2 = ifp2->name;
-
while (*p1 && *p2) {
/* look up to any number */
l1 = strcspn(p1, "0123456789");
@@ -113,6 +109,12 @@ if_cmp_func (struct interface *ifp1, struct interface *ifp2)
return 0;
}
+static int
+if_cmp_func (struct interface *ifp1, struct interface *ifp2)
+{
+ return if_cmp_name_func (ifp1->name, ifp2->name);
+}
+
/* Create new interface structure. */
struct interface *
if_create_vrf (const char *name, int namelen, vrf_id_t vrf_id)