From 850c85b980e8c732017569798a0ff1bdff74a253 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Thu, 9 Jul 2020 15:07:50 -0400 Subject: [PATCH] lib: use const in nexthop_level() api Use const in nexthop_level() Signed-off-by: Mark Stapp --- lib/nexthop.c | 5 +++-- lib/nexthop.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/nexthop.c b/lib/nexthop.c index 891ee64d64..28d96a539c 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -525,11 +525,12 @@ struct nexthop *nexthop_next_active_resolved(const struct nexthop *nexthop) return next; } -unsigned int nexthop_level(struct nexthop *nexthop) +unsigned int nexthop_level(const struct nexthop *nexthop) { unsigned int rv = 0; - for (struct nexthop *par = nexthop->rparent; par; par = par->rparent) + for (const struct nexthop *par = nexthop->rparent; + par; par = par->rparent) rv++; return rv; diff --git a/lib/nexthop.h b/lib/nexthop.h index eaf67e6af1..ed40cc7eed 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -220,7 +220,7 @@ extern const char *nexthop2str(const 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); +extern unsigned int nexthop_level(const struct nexthop *nexthop); /* Copies to an already allocated nexthop struct */ extern void nexthop_copy(struct nexthop *copy, const struct nexthop *nexthop, struct nexthop *rparent); -- 2.39.5