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.

Merges: #333
Reviewed-by: Jan Pokorný <jpokorny@redhat.com>
  • Loading branch information
chrissie-c authored and jnpkrn committed Dec 12, 2018
1 parent 926e851 commit 60887f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/skiplist.c
Expand Up @@ -505,10 +505,10 @@ 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 60887f4

Please sign in to comment.