#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")
/* 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;
}
k = randomLevel();
+ assert(k >= 0);
if (k > l->level) {
k = ++l->level;
update[k] = l->header;
if (!l)
l = skiplist_last_created;
- vty_out(vty, "Skiplist %p has max level %d%s", l, l->level,
- VTY_NEWLINE);
+ vty_out(vty, "Skiplist %p has max level %d\n", l, l->level);
for (i = l->level; i >= 0; --i)
- vty_out(vty, " @%d: %ld%s", i,
+ vty_out(vty, " @%d: %ld\n", i,
(long)((l->stats->forward[i])
- - (struct skiplistnode *)NULL),
- VTY_NEWLINE);
+ - (struct skiplistnode *)NULL));
}
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;
}