[PPL-devel] [GIT] ppl/ppl(master): Reduced the scope of some variables.

Roberto Bagnara bagnara at cs.unipr.it
Sat Feb 18 19:33:48 CET 2012


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

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Sat Feb 18 19:33:38 2012 +0100

Reduced the scope of some variables.
Detected by ECLAIR service minscope.

---

 src/Bit_Row.cc             |    3 +--
 src/Box.templates.hh       |    2 +-
 src/Linear_Form.inlines.hh |    5 +++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Bit_Row.cc b/src/Bit_Row.cc
index f9c73bd..47f153c 100644
--- a/src/Bit_Row.cc
+++ b/src/Bit_Row.cc
@@ -32,9 +32,8 @@ unsigned long
 PPL::Bit_Row::first() const {
   const mp_size_t vec_size = vec->_mp_size;
   PPL_ASSERT(vec_size >= 0);
-  mp_size_t li = 0;
   mp_srcptr p = vec->_mp_d;
-  for (; li < vec_size; ++li, ++p) {
+  for (mp_size_t li = 0; li < vec_size; ++li, ++p) {
     const mp_limb_t limb = *p;
     if (limb != 0)
       return li*PPL_BITS_PER_GMP_LIMB + Implementation::first_one(limb);
diff --git a/src/Box.templates.hh b/src/Box.templates.hh
index 1eb7023..e20fdc4 100644
--- a/src/Box.templates.hh
+++ b/src/Box.templates.hh
@@ -2364,7 +2364,6 @@ Box<ITV>::propagate_constraint_no_check(const Constraint& c) {
 
   // Here constraint c is non-trivial.
   PPL_ASSERT(last_k < c_space_dim);
-  Result r;
   Temp_Boundary_Type t_bound;
   Temp_Boundary_Type t_a;
   Temp_Boundary_Type t_x;
@@ -2374,6 +2373,7 @@ Box<ITV>::propagate_constraint_no_check(const Constraint& c) {
     int sgn_a_k = sgn(a_k);
     if (sgn_a_k == 0)
       continue;
+    Result r;
     if (sgn_a_k > 0) {
       open = (c_type == Constraint::STRICT_INEQUALITY) ? T_YES : T_NO;
       if (open == T_NO)
diff --git a/src/Linear_Form.inlines.hh b/src/Linear_Form.inlines.hh
index 6778d68..de26a74 100644
--- a/src/Linear_Form.inlines.hh
+++ b/src/Linear_Form.inlines.hh
@@ -200,9 +200,10 @@ Linear_Form<C>::ascii_dump(std::ostream& s) const {
   using namespace IO_Operators;
   dimension_type space_dim = space_dimension();
   s << space_dim << "\n";
-  const char separator = ' ';
-  for (dimension_type i = 0; i <= space_dim; ++i)
+  for (dimension_type i = 0; i <= space_dim; ++i) {
+    const char separator = ' ';
     s << vec[i] << separator;
+  }
   s << "\n";
 }
 




More information about the PPL-devel mailing list