[PPL-devel] [GIT] ppl/ppl(master): Unwanted recursion removed.

Roberto Bagnara bagnara at cs.unipr.it
Fri Aug 17 14:05:02 CEST 2012


Module: ppl/ppl
Branch: master
Commit: 3307c8da8a4a3d8b98e6f8561c90e45a84b3098a
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=3307c8da8a4a3d8b98e6f8561c90e45a84b3098a

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Fri Aug 17 14:03:52 2012 +0200

Unwanted recursion removed.
Detected by ECLAIR service funrecsn.

---

 src/CO_Tree.cc |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/CO_Tree.cc b/src/CO_Tree.cc
index 1f57df3..cbc1d50 100644
--- a/src/CO_Tree.cc
+++ b/src/CO_Tree.cc
@@ -536,17 +536,16 @@ PPL::CO_Tree::erase(tree_iterator itr) {
 }
 
 void
-PPL::CO_Tree::init(dimension_type reserved_size1) {
-  if (reserved_size1 == 0) {
-    indexes = NULL;
-    data = NULL;
-    size_ = 0;
-    reserved_size = 0;
-    max_depth = 0;
-  }
-  else {
+PPL::CO_Tree::init(dimension_type n) {
+  indexes = NULL;
+  data = NULL;
+  size_ = 0;
+  reserved_size = 0;
+  max_depth = 0;
+
+  if (n > 0) {
     init(0);
-    const dimension_type new_max_depth = integer_log2(reserved_size1) + 1;
+    const dimension_type new_max_depth = integer_log2(n) + 1;
     const dimension_type new_reserved_size
       = (static_cast<dimension_type>(1) << new_max_depth) - 1;
     // If this throws, *this will be the empty tree.




More information about the PPL-devel mailing list