From: Kefu Chai Date: Fri, 17 Jan 2020 05:14:09 +0000 (+0800) Subject: include/cpp-btree: drop btree::dump() X-Git-Tag: v15.1.0~167^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b6b515c8187b874b67ece5639a030adf4ff458f0;p=ceph.git include/cpp-btree: drop btree::dump() btree::dump() is a helper for printing out all the leaf nodes in a btree, it's used by "operator<<()". but this operator is not used. let's remove it. Signed-off-by: Kefu Chai --- diff --git a/src/include/cpp-btree/btree.h b/src/include/cpp-btree/btree.h index df2415867dcec..bacb034839fc5 100644 --- a/src/include/cpp-btree/btree.h +++ b/src/include/cpp-btree/btree.h @@ -51,7 +51,6 @@ #include #include #include -#include #include #include #include @@ -1145,14 +1144,6 @@ class btree { return compare_result_as_less_than(key_comp()(x, y)); } - // Dump the btree to the specified ostream. Requires that operator<< is - // defined for Key and Value. - void dump(std::ostream &os) const { - if (root() != NULL) { - internal_dump(os, root(), 0); - } - } - // Verifies the structure of the btree. void verify() const; @@ -1385,9 +1376,6 @@ class btree { // Deletes a node and all of its children. void internal_clear(node_type *node); - // Dumps a node and all of its children to the specified ostream. - void internal_dump(std::ostream &os, const node_type *node, int level) const; - // Verifies the tree structure of node. int internal_verify(const node_type *node, const key_type *lo, const key_type *hi) const; @@ -2526,23 +2514,6 @@ void btree

::internal_clear(node_type *node) { } } -template -void btree

::internal_dump( - std::ostream &os, const node_type *node, int level) const { - for (int i = 0; i < node->count(); ++i) { - if (!node->leaf()) { - internal_dump(os, node->child(i), level + 1); - } - for (int j = 0; j < level; ++j) { - os << " "; - } - os << node->key(i) << " [" << level << "]\n"; - } - if (!node->leaf()) { - internal_dump(os, node->child(node->count()), level + 1); - } -} - template int btree

::internal_verify( const node_type *node, const key_type *lo, const key_type *hi) const { diff --git a/src/include/cpp-btree/btree_container.h b/src/include/cpp-btree/btree_container.h index 2cd964ce01fe5..bcbd1ff4511da 100644 --- a/src/include/cpp-btree/btree_container.h +++ b/src/include/cpp-btree/btree_container.h @@ -142,7 +142,6 @@ class btree_container { void clear() { tree_.clear(); } void swap(btree_container &x) { tree_.swap(x.tree_); } void verify() const { tree_.verify(); } - void dump(std::ostream &os) const { tree_.dump(os); } // Size routines. size_type size() const { return tree_.size(); } @@ -185,12 +184,6 @@ class btree_container { Tree tree_; }; -template -inline std::ostream& operator<<(std::ostream &os, const btree_container &b) { - b.dump(os); - return os; -} - // A common base class for btree_set and btree_map. template class btree_set_container : public btree_container {