Skip to content

Commit

Permalink
skiplist: Fix previous skiplist fix
Browse files Browse the repository at this point in the history
The last fix to skiplist never ran the code that patched up the level
list as it updated the current level before runnign the loop.

This now works.
  • Loading branch information
chrissie-c committed Dec 11, 2018
1 parent 926e851 commit a375be6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/skiplist.c
Expand Up @@ -505,10 +505,11 @@ skiplist_rm(struct qb_map *map, const char *key)
(header) preceding @found_node, which can be distinguished with
NULL being used as a key (second allowing condition below). */
if (found_node->refcount > 1 || cur_node->key == NULL) {
found_node->level = SKIPLIST_LEVEL_MIN - 1; /* no "forward" drop */

for (level = SKIPLIST_LEVEL_MIN; level <= found_node->level; level++) {
found_node->forward[level] = cur_node->forward[level];
}
found_node->level = SKIPLIST_LEVEL_MIN - 1; /* no "forward" drop */
free(cur_node->forward);
cur_node->forward = found_node->forward;
}
Expand Down

0 comments on commit a375be6

Please sign in to comment.