[counting_visitor] cleanup: remove redundant statements

This commit is contained in:
Ming-Hung Tsai 2016-04-05 17:05:28 +08:00
parent 9322fc9f14
commit 810e86e675

View File

@ -57,6 +57,9 @@ namespace persistent_data {
private: private:
bool check_internal(node_location const &l, bool check_internal(node_location const &l,
btree_detail::node_ref<block_traits> const &n) { btree_detail::node_ref<block_traits> const &n) {
if (l.is_sub_root())
new_root(l.level());
if (!checker_.check_block_nr(n) || if (!checker_.check_block_nr(n) ||
!checker_.check_value_size(n) || !checker_.check_value_size(n) ||
!checker_.check_max_entries(n) || !checker_.check_max_entries(n) ||
@ -65,31 +68,28 @@ namespace persistent_data {
!checker_.check_parent_key(n, l.is_sub_root() ? boost::optional<uint64_t>() : l.key)) !checker_.check_parent_key(n, l.is_sub_root() ? boost::optional<uint64_t>() : l.key))
return false; return false;
if (l.is_sub_root())
new_root(l.level());
return true; return true;
} }
template <typename ValueTraits2> template <typename ValueTraits2>
bool check_leaf(node_location const &l, bool check_leaf(node_location const &l,
btree_detail::node_ref<ValueTraits2> const &n) { btree_detail::node_ref<ValueTraits2> const &n) {
if (l.is_sub_root())
new_root(l.level());
if (!checker_.check_block_nr(n) || if (!checker_.check_block_nr(n) ||
!checker_.check_value_size(n) || !checker_.check_value_size(n) ||
!checker_.check_max_entries(n) || !checker_.check_max_entries(n) ||
!checker_.check_nr_entries(n, l.is_sub_root()) || !checker_.check_nr_entries(n, l.is_sub_root()) ||
!checker_.check_ordered_keys(n) || !checker_.check_ordered_keys(n) ||
!checker_.check_parent_key(n, l.is_sub_root() ? boost::optional<uint64_t>() : l.key)) !checker_.check_parent_key(n, l.is_sub_root() ? boost::optional<uint64_t>() : l.key) ||
!checker_.check_leaf_key(n, last_leaf_key_[l.level()]))
return false; return false;
if (l.is_sub_root()) if (n.get_nr_entries() > 0)
new_root(l.level());
bool r = checker_.check_leaf_key(n, last_leaf_key_[l.level()]);
if (r && n.get_nr_entries() > 0)
last_leaf_key_[l.level()] = n.key_at(n.get_nr_entries() - 1); last_leaf_key_[l.level()] = n.key_at(n.get_nr_entries() - 1);
return r; return true;
} }
void new_root(unsigned level) { void new_root(unsigned level) {