From 810e86e675170c04bbf33e0cc3a8809ae2893ca0 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Tue, 5 Apr 2016 17:05:28 +0800 Subject: [PATCH] [counting_visitor] cleanup: remove redundant statements --- .../data-structures/btree_counter.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/persistent-data/data-structures/btree_counter.h b/persistent-data/data-structures/btree_counter.h index 1b8c7a2..ec74e86 100644 --- a/persistent-data/data-structures/btree_counter.h +++ b/persistent-data/data-structures/btree_counter.h @@ -57,6 +57,9 @@ namespace persistent_data { private: bool check_internal(node_location const &l, btree_detail::node_ref const &n) { + if (l.is_sub_root()) + new_root(l.level()); + if (!checker_.check_block_nr(n) || !checker_.check_value_size(n) || !checker_.check_max_entries(n) || @@ -65,31 +68,28 @@ namespace persistent_data { !checker_.check_parent_key(n, l.is_sub_root() ? boost::optional() : l.key)) return false; - if (l.is_sub_root()) - new_root(l.level()); - return true; } template bool check_leaf(node_location const &l, btree_detail::node_ref const &n) { + if (l.is_sub_root()) + new_root(l.level()); + if (!checker_.check_block_nr(n) || !checker_.check_value_size(n) || !checker_.check_max_entries(n) || !checker_.check_nr_entries(n, l.is_sub_root()) || !checker_.check_ordered_keys(n) || - !checker_.check_parent_key(n, l.is_sub_root() ? boost::optional() : l.key)) + !checker_.check_parent_key(n, l.is_sub_root() ? boost::optional() : l.key) || + !checker_.check_leaf_key(n, last_leaf_key_[l.level()])) return false; - if (l.is_sub_root()) - new_root(l.level()); - - bool r = checker_.check_leaf_key(n, last_leaf_key_[l.level()]); - if (r && n.get_nr_entries() > 0) + if (n.get_nr_entries() > 0) last_leaf_key_[l.level()] = n.key_at(n.get_nr_entries() - 1); - return r; + return true; } void new_root(unsigned level) {