Fix a g++-4.7 warning about a variable used only in an assert().

* src/tgbaalgos/weight.cc (inc_weight_handler)
(dec_weight_handler): Remove these assertions that require the
loop the be completed, and use break to exit ASAP.
This commit is contained in:
Alexandre Duret-Lutz 2011-11-11 22:36:38 +01:00
parent 9130d6f58c
commit 2b5956c2d4
2 changed files with 12 additions and 6 deletions

View file

@ -1,3 +1,11 @@
2011-11-11 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Fix a g++-4.7 warning about a variable used only in an assert().
* src/tgbaalgos/weight.cc (inc_weight_handler)
(dec_weight_handler): Remove these assertions that require the
loop the be completed, and use break to exit ASAP.
2011-11-08 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Allow neverclaim guards of the form `!(x)' or `! (x)'.

View file

@ -1,3 +1,5 @@
// Copyright (C) 2011 Laboratoire de Recherche et Developpement de
// l'Epita.
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
@ -33,17 +35,15 @@ namespace spot
void weight::inc_weight_handler(char* varset, int size)
{
bool ok = true;
for (int v = 0; v < size; ++v)
if (varset[v] > 0)
{
assert(ok);
ok=false;
weight::weight_vector::iterator it = pm->find(v);
if (it == pm->end())
pm->insert(std::make_pair(v, 1));
else
++(it->second);
break;
}
}
@ -56,18 +56,16 @@ namespace spot
void weight::dec_weight_handler(char* varset, int size)
{
bool ok = true;
for (int v = 0; v < size; ++v)
if (varset[v] > 0)
{
assert(ok);
ok=false;
weight::weight_vector::iterator it = pm->find(v);
assert(it != pm->end() && it->second > 0);
if (it->second > 1)
--(it->second);
else
pm->erase(it);
break;
}
}