X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=map%2Fskiplist.c;fp=map%2Fskiplist.c;h=e81a89680154e3ef3b6e55edd9f75c17efe85f89;hp=c2777a904f188ff215a7681fea0dd934540275b2;hb=8c48c212e119ba28b0666c9ec3faa97cbd11ca7a;hpb=2cce67f0002cdb6dcdc2ab8ccf837e3d2b3336de diff --git a/map/skiplist.c b/map/skiplist.c index c2777a9..e81a896 100644 --- a/map/skiplist.c +++ b/map/skiplist.c @@ -123,14 +123,13 @@ static node_t *find_preds (node_t **preds, node_t **succs, int n, skiplist_t *sl // Traverse the levels of from the top level to the bottom for (int level = start_level; level >= 0; --level) { TRACE("s3", "find_preds: level %llu", level, 0); - uint64_t next = pred->next[level]; - if (EXPECT_FALSE(IS_TAGGED(next, TAG1))) { - TRACE("s2", "find_preds: pred %p is marked for removal (next %p); retry", pred, next); + item = (node_t *)pred->next[level]; + if (EXPECT_FALSE(IS_TAGGED((uint64_t)item, TAG1))) { + TRACE("s2", "find_preds: pred %p is marked for removal (item %p); retry", pred, item); return find_preds(preds, succs, n, sl, key, help_remove); // retry } - while (next != DOES_NOT_EXIST) { - item = (node_t *)(size_t)next; - next = item->next[level]; + while (item != NULL) { + uint64_t next = item->next[level]; // A tag means an item is logically removed but not physically unlinked yet. while (EXPECT_FALSE(IS_TAGGED(next, TAG1))) {