| Index: src/splay-tree-inl.h
|
| diff --git a/src/splay-tree-inl.h b/src/splay-tree-inl.h
|
| index 9c2287eab7e98ca7c25401f8ed16635faa603698..effcec30c6c0677fa64290d0d301e9269b38de0c 100644
|
| --- a/src/splay-tree-inl.h
|
| +++ b/src/splay-tree-inl.h
|
| @@ -36,7 +36,7 @@ namespace internal {
|
|
|
| template<typename Config, class Allocator>
|
| SplayTree<Config, Allocator>::~SplayTree() {
|
| - NodeDeleter deleter;
|
| + NodeDeleter deleter(&allocator_);
|
| ForEachNode(&deleter);
|
| }
|
|
|
| @@ -45,7 +45,7 @@ template<typename Config, class Allocator>
|
| bool SplayTree<Config, Allocator>::Insert(const Key& key, Locator* locator) {
|
| if (is_empty()) {
|
| // If the tree is empty, insert the new node.
|
| - root_ = new Node(key, Config::kNoValue);
|
| + root_ = new(&allocator_) Node(key, Config::kNoValue);
|
| } else {
|
| // Splay on the key to move the last node on the search path
|
| // for the key to the root of the tree.
|
| @@ -57,7 +57,7 @@ bool SplayTree<Config, Allocator>::Insert(const Key& key, Locator* locator) {
|
| return false;
|
| }
|
| // Insert the new node.
|
| - Node* node = new Node(key, Config::kNoValue);
|
| + Node* node = new(&allocator_) Node(key, Config::kNoValue);
|
| InsertInternal(cmp, node);
|
| }
|
| locator->bind(root_);
|
| @@ -183,7 +183,7 @@ bool SplayTree<Config, Allocator>::Move(const Key& old_key,
|
| int cmp = Config::Compare(new_key, root_->key_);
|
| if (cmp == 0) {
|
| // A node with the target key already exists.
|
| - delete node_to_move;
|
| + Node::Delete(&allocator_, node_to_move);
|
| return false;
|
| }
|
| node_to_move->key_ = new_key;
|
| @@ -198,7 +198,7 @@ bool SplayTree<Config, Allocator>::Remove(const Key& key) {
|
| return false;
|
| Node* node_to_remove = root_;
|
| RemoveRootNode(key);
|
| - delete node_to_remove;
|
| + Node::Delete(&allocator_, node_to_remove);
|
| return true;
|
| }
|
|
|
| @@ -293,7 +293,7 @@ void SplayTree<Config, Allocator>::ForEach(Callback* callback) {
|
| template <typename Config, class Allocator> template <class Callback>
|
| void SplayTree<Config, Allocator>::ForEachNode(Callback* callback) {
|
| // Pre-allocate some space for tiny trees.
|
| - List<Node*, Allocator> nodes_to_visit(10);
|
| + List<Node*, Allocator> nodes_to_visit(10, allocator_);
|
| if (root_ != NULL) nodes_to_visit.Add(root_);
|
| int pos = 0;
|
| while (pos < nodes_to_visit.length()) {
|
|
|