]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/skiplist.c
zebra: Refactor kernel_rtm to be a bit smarter about how it handles options
[mirror_frr.git] / lib / skiplist.c
index 7acc78f563729e7f32aef1cd4074cedab6376b4e..3933429c3b0bd737dde7fda12cea324dc81c4b15 100644 (file)
@@ -60,6 +60,7 @@
 #include "log.h"
 #include "vty.h"
 #include "skiplist.h"
+#include "lib_errors.h"
 
 DEFINE_MTYPE_STATIC(LIB, SKIP_LIST, "Skip List")
 DEFINE_MTYPE_STATIC(LIB, SKIP_LIST_NODE, "Skip Node")
@@ -182,7 +183,8 @@ int skiplist_insert(register struct skiplist *l, register void *key,
 
        /* DEBUG */
        if (!key) {
-               zlog_err("%s: key is 0, value is %p", __func__, value);
+               flog_err(EC_LIB_DEVELOPMENT, "%s: key is 0, value is %p",
+                        __func__, value);
        }
 
        p = l->header;
@@ -200,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;
@@ -593,8 +596,8 @@ static void *scramble(int i)
 {
        uintptr_t result;
 
-       result = (i & 0xff) << 24;
-       result |= (i >> 8);
+       result = (unsigned)(i & 0xff) << 24;
+       result |= (unsigned)i >> 8;
 
        return (void *)result;
 }