[PPL-devel] [GIT] ppl/ppl(master): Scope of variables reduced.

Roberto Bagnara bagnara at cs.unipr.it
Thu Nov 3 20:39:39 CET 2011


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

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Thu Nov  3 20:38:48 2011 +0100

Scope of variables reduced.
Detected by ECLAIR service minscope.

---

 src/Linear_Form.inlines.hh |    9 ++++-----
 src/checked.cc             |    5 +++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/Linear_Form.inlines.hh b/src/Linear_Form.inlines.hh
index 65ab261..2e0cfba 100644
--- a/src/Linear_Form.inlines.hh
+++ b/src/Linear_Form.inlines.hh
@@ -197,10 +197,10 @@ template <typename C>
 inline void
 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 = ' ';
-  dimension_type space = space_dimension();
-  s << space << "\n";
-  for (dimension_type i = 0; i <= space; ++i)
+  for (dimension_type i = 0; i <= space_dim; ++i)
     s << vec[i] << separator;
   s << "\n";
 }
@@ -230,8 +230,7 @@ Linear_Form<C>::overflows() const {
   if (!inhomogeneous_term().is_bounded())
     return true;
 
-  dimension_type dimension = space_dimension();
-  for (dimension_type i = 0; i < dimension; ++i) {
+  for (dimension_type i = space_dimension(); i-- > 0; ) {
     if (!coefficient(Variable(i)).is_bounded())
       return true;
   }
diff --git a/src/checked.cc b/src/checked.cc
index e886489..0e33f2a 100644
--- a/src/checked.cc
+++ b/src/checked.cc
@@ -219,9 +219,10 @@ parse_number_part(std::istream& is, number_struct& num) {
           return V_CVT_STR_UNK;
         if (c != '^')
           goto unexpected;
-        std::string::const_iterator i;
         num.base = 0;
-        for (i = num.mantissa.begin(); i != num.mantissa.end(); i++) {
+        for (std::string::const_iterator i = num.mantissa.begin();
+             i != num.mantissa.end();
+             i++) {
           num.base = num.base * 10 + get_digit(*i, 10);
           if (num.base > 36)
             goto unexpected;




More information about the PPL-devel mailing list