]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Make nexthop_next* use const for nexthop
authorStephen Worley <sworley@cumulusnetworks.com>
Wed, 23 Oct 2019 18:37:20 +0000 (14:37 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 25 Oct 2019 15:13:44 +0000 (11:13 -0400)
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>
lib/nexthop.c
lib/nexthop.h

index 017131882725fd3228e81618ddb97c069f8b6bd0..73c2de0cd80ead88df7a117b94b0c456665ac1b2 100644 (file)
@@ -349,7 +349,7 @@ const char *nexthop2str(const struct nexthop *nexthop, char *str, int size)
  * 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;
@@ -365,7 +365,7 @@ struct nexthop *nexthop_next(struct nexthop *nexthop)
 }
 
 /* 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);
 
index 480c4cc3dd696091acd17d9b3696124cf0feb9d3..fe029f1867932345182852d4d006cf7fc4c61cc4 100644 (file)
@@ -161,8 +161,9 @@ extern int nexthop_same_firsthop(struct nexthop *next1, struct nexthop *next2);
 
 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,