Cleanup skiplist insert_here method

Reviewers: dgleich

Reviewed By: dgleich

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D907
This commit is contained in:
Mislav Bradac 2017-10-16 15:09:41 +02:00
parent f6b1c9b6e2
commit ebe3c74a84

View File

@ -914,7 +914,7 @@ class SkipList : private Lockable<lock_t> {
if (!lock_nodes<true>(height, guards, preds, succs)) continue; if (!lock_nodes<true>(height, guards, preds, succs)) continue;
return {insert_here(Node::create(std::forward<TItem>(data), height), return {insert_here(Node::create(std::forward<TItem>(data), height),
preds, succs, height, guards), preds, succs, height),
true}; true};
} }
} }
@ -948,7 +948,7 @@ class SkipList : private Lockable<lock_t> {
if (!lock_nodes<true>(height, guards, preds, succs)) continue; if (!lock_nodes<true>(height, guards, preds, succs)) continue;
return {insert_here(Node::emplace(height, std::forward<Args>(args)...), return {insert_here(Node::emplace(height, std::forward<Args>(args)...),
preds, succs, height, guards), preds, succs, height),
true}; true};
} }
} }
@ -956,9 +956,8 @@ class SkipList : private Lockable<lock_t> {
/** /**
* Inserts data to specified locked location. * Inserts data to specified locked location.
*/ */
Iterator insert_here(Node *new_node, Node *preds[], Node *succs[], int height, Iterator insert_here(Node *new_node, Node *preds[], Node *succs[],
guard_t guards[]) { int height) {
// TODO: guards unused
// link the predecessors and successors, e.g. // link the predecessors and successors, e.g.
// //
// 4 HEAD ... P ------------------------> S ... NULL // 4 HEAD ... P ------------------------> S ... NULL