From: Claudio Jeker Subject: bgpd: make nexthop_compare static inline To: tech@openbsd.org Date: Wed, 29 May 2024 11:45:50 +0200 Rename nexthop_compare to nexthop_cmp and make it static inline. It is only used by the nexthop_tree RB tree. -- :wq Claudio Index: rde.h =================================================================== RCS file: /cvs/src/usr.sbin/bgpd/rde.h,v diff -u -p -r1.302 rde.h --- rde.h 22 May 2024 08:41:14 -0000 1.302 +++ rde.h 27 May 2024 09:42:19 -0000 @@ -680,7 +680,6 @@ void nexthop_update(struct kroute_next struct nexthop *nexthop_get(struct bgpd_addr *); struct nexthop *nexthop_ref(struct nexthop *); int nexthop_unref(struct nexthop *); -int nexthop_compare(struct nexthop *, struct nexthop *); /* rde_update.c */ void up_generate_updates(struct rde_peer *, struct rib_entry *); Index: rde_rib.c =================================================================== RCS file: /cvs/src/usr.sbin/bgpd/rde_rib.c,v diff -u -p -r1.261 rde_rib.c --- rde_rib.c 16 Oct 2023 10:25:46 -0000 1.261 +++ rde_rib.c 28 May 2024 10:53:34 -0000 @@ -1644,7 +1644,10 @@ TAILQ_HEAD(nexthop_queue, nexthop) nexth RB_HEAD(nexthop_tree, nexthop) nexthoptable = RB_INITIALIZER(&nexthoptree); -RB_GENERATE_STATIC(nexthop_tree, nexthop, entry, nexthop_compare); + +static inline int nexthop_cmp(struct nexthop *, struct nexthop *); + +RB_GENERATE_STATIC(nexthop_tree, nexthop, entry, nexthop_cmp); void nexthop_shutdown(void) @@ -1834,7 +1837,7 @@ nexthop_get(struct bgpd_addr *nexthop) if (nh == NULL) { nh = calloc(1, sizeof(*nh)); if (nh == NULL) - fatal("nexthop_alloc"); + fatal("nexthop_get"); rdemem.nexthop_cnt++; LIST_INIT(&nh->prefix_h); @@ -1882,8 +1885,8 @@ nexthop_unref(struct nexthop *nh) return (1); } -int -nexthop_compare(struct nexthop *na, struct nexthop *nb) +static inline int +nexthop_cmp(struct nexthop *na, struct nexthop *nb) { struct bgpd_addr *a, *b;