Make nexthop_next() and nexthop_next_active_resolved() use
const for the nexthop argument. They should not be modifying so
it makes sense here.
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* left branch is 'resolved' and right branch is 'next':
* https://en.wikipedia.org/wiki/Tree_traversal#/media/File:Sorted_binary_tree_preorder.svg
*/
-struct nexthop *nexthop_next(struct nexthop *nexthop)
+struct nexthop *nexthop_next(const struct nexthop *nexthop)
{
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
return nexthop->resolved;
}
/* Return the next nexthop in the tree that is resolved and active */
-struct nexthop *nexthop_next_active_resolved(struct nexthop *nexthop)
+struct nexthop *nexthop_next_active_resolved(const struct nexthop *nexthop)
{
struct nexthop *next = nexthop_next(nexthop);
extern const char *nexthop2str(const struct nexthop *nexthop,
char *str, int size);
-extern struct nexthop *nexthop_next(struct nexthop *nexthop);
-extern struct nexthop *nexthop_next_active_resolved(struct nexthop *nexthop);
+extern struct nexthop *nexthop_next(const struct nexthop *nexthop);
+extern struct nexthop *
+nexthop_next_active_resolved(const struct nexthop *nexthop);
extern unsigned int nexthop_level(struct nexthop *nexthop);
/* Copies to an already allocated nexthop struct */
extern void nexthop_copy(struct nexthop *copy, const struct nexthop *nexthop,