]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: fix SA warning in skiplist code
authorDavid Lamparter <equinox@opensourcerouting.org>
Sat, 8 Sep 2018 17:47:05 +0000 (19:47 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sat, 8 Sep 2018 18:34:35 +0000 (20:34 +0200)
Clang was thinking the random level could be negative.  (And, no, I
couldn't figure that out by reading its output... trial and error this
was.)

Signed-off-by: David Lamparter <equinox@diac24.net>
lib/skiplist.c

index a36bf47139c307ceacc85629427a747dec394939..585cf859e5742b1a952a0ba935e6c9f1c6b19d56 100644 (file)
@@ -202,6 +202,7 @@ int skiplist_insert(register struct skiplist *l, register void *key,
        }
 
        k = randomLevel();
+       assert(k >= 0);
        if (k > l->level) {
                k = ++l->level;
                update[k] = l->header;