| Index: src/splay-tree-inl.h
|
| diff --git a/src/splay-tree-inl.h b/src/splay-tree-inl.h
|
| index bb6ded7098b78d8f384e084e3d4adb88d9d6c7a7..4eca71d1004f10ad49b9515c825fb4babc9e4e9a 100644
|
| --- a/src/splay-tree-inl.h
|
| +++ b/src/splay-tree-inl.h
|
| @@ -43,11 +43,10 @@ SplayTree<Config, Allocator>::~SplayTree() {
|
|
|
| template<typename Config, class Allocator>
|
| bool SplayTree<Config, Allocator>::Insert(const Key& key,
|
| - Locator* locator,
|
| - Allocator allocator) {
|
| + Locator* locator) {
|
| if (is_empty()) {
|
| // If the tree is empty, insert the new node.
|
| - root_ = new(allocator) Node(key, Config::NoValue());
|
| + root_ = new(allocator_) Node(key, Config::NoValue());
|
| } else {
|
| // Splay on the key to move the last node on the search path
|
| // for the key to the root of the tree.
|
| @@ -59,7 +58,7 @@ bool SplayTree<Config, Allocator>::Insert(const Key& key,
|
| return false;
|
| }
|
| // Insert the new node.
|
| - Node* node = new(allocator) Node(key, Config::NoValue());
|
| + Node* node = new(allocator_) Node(key, Config::NoValue());
|
| InsertInternal(cmp, node);
|
| }
|
| locator->bind(root_);
|
| @@ -293,16 +292,15 @@ void SplayTree<Config, Allocator>::ForEach(Callback* callback) {
|
|
|
|
|
| template <typename Config, class Allocator> template <class Callback>
|
| -void SplayTree<Config, Allocator>::ForEachNode(Callback* callback,
|
| - Allocator allocator) {
|
| +void SplayTree<Config, Allocator>::ForEachNode(Callback* callback) {
|
| // Pre-allocate some space for tiny trees.
|
| - List<Node*, Allocator> nodes_to_visit(10);
|
| - if (root_ != NULL) nodes_to_visit.Add(root_, allocator);
|
| + List<Node*, Allocator> nodes_to_visit(10, allocator_);
|
| + if (root_ != NULL) nodes_to_visit.Add(root_, allocator_);
|
| int pos = 0;
|
| while (pos < nodes_to_visit.length()) {
|
| Node* node = nodes_to_visit[pos++];
|
| - if (node->left() != NULL) nodes_to_visit.Add(node->left(), allocator);
|
| - if (node->right() != NULL) nodes_to_visit.Add(node->right(), allocator);
|
| + if (node->left() != NULL) nodes_to_visit.Add(node->left(), allocator_);
|
| + if (node->right() != NULL) nodes_to_visit.Add(node->right(), allocator_);
|
| callback->Call(node);
|
| }
|
| }
|
|
|