]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Remove unnecessary comparison, for linked list 12164/head
authorDonald Sharp <sharpd@nvidia.com>
Wed, 19 Oct 2022 16:57:28 +0000 (12:57 -0400)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Fri, 21 Oct 2022 04:44:22 +0000 (04:44 +0000)
In the comparison function for a linked list code was
always checking against passed in NULL's.  The comparison
function will never receive a NULL value for data from
the linklist.c code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 78946603e10489969bad3b364a96ca01d436b47d)

lib/routemap.c

index 3cc010c148d454cdf4147367d4acb69a33b75b0d..2b3347820746bbf036fa628eb39dd15c3ee31c83 100644 (file)
@@ -1890,12 +1890,7 @@ route_map_get_index(struct route_map *map, const struct prefix *prefix,
 static int route_map_candidate_list_cmp(struct route_map_index *idx1,
                                        struct route_map_index *idx2)
 {
-       if (!idx1)
-               return -1;
-       if (!idx2)
-               return 1;
-
-       return (idx1->pref - idx2->pref);
+       return idx1->pref - idx2->pref;
 }
 
 /*