* src/sanity/style.test: Warn about places where size() is used

instead of empty().
* src/misc/bddalloc.cc (bdd_allocator::extend): Use empty() rather
than size() when checking emptiness of lists.
* src/tgbaalgos/reductgba_sim_del.cc, src/tgbaalgos/minimalce.cc,
src/ltlvisit/basicreduce.cc, src/ltlvisit/reduce.cc,
src/tgbaalgos/gtec/ce.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/misc/minato.cc: Likewise.
* src/ltlast/multop.cc (multop::instance): Call ->size() only once.
This commit is contained in:
Alexandre Duret-Lutz 2004-09-21 13:01:27 +00:00
parent f0aa58034c
commit c30823f7be
11 changed files with 57 additions and 39 deletions

View file

@ -338,9 +338,9 @@ namespace spot
todo.pop();
delete iter;
seen.erase(s);
if (todo.size())
if (!todo.empty())
{
assert(path.size());
assert(!path.empty());
path.pop_back();
}
continue;
@ -377,7 +377,7 @@ namespace spot
// If we already have a best path, let see if the current
// one is better.
if (best_path.size())
if (!best_path.empty())
{
// When comparing the merits of two paths, only the
// acceptance conditions we are trying the traverse
@ -491,9 +491,9 @@ namespace spot
todo.pop();
delete iter;
seen.erase(s);
if (todo.size())
if (!todo.empty())
{
assert(path.size());
assert(!path.empty());
path.pop_back();
}
continue;
@ -530,7 +530,7 @@ namespace spot
// If we already have a best path, let see if the current
// one is better.
if (best_path.size())
if (!best_path.empty())
{
// When comparing the merits of two paths, only the
// acceptance conditions we are trying the traverse

View file

@ -552,7 +552,7 @@ namespace spot
~formula_canonizer()
{
while (f2b_.size())
while (!f2b_.empty())
{
formula_to_bdd_map::iterator i = f2b_.begin();
const formula* f = i->first;

View file

@ -174,7 +174,7 @@ namespace spot
++id;
}
assert(cycle.size() != 0);
assert(!cycle.empty());
is = cycle.end();
is--;
id = cycle.begin();
@ -593,7 +593,7 @@ namespace spot
recurse_find(s, os);
//std::cout << "nb_found : " << nb_found << std::endl;
if (min_ce->size() == 0)
if (min_ce->empty())
{
delete min_ce;
min_ce = 0;
@ -629,7 +629,7 @@ namespace spot
hash_type::iterator i;
tgba_succ_iterator* iter = 0;
if (!h_lenght.size())
if (h_lenght.empty())
{
// it's a new search
//std::cout << "it's a new search" << std::endl;
@ -670,7 +670,7 @@ namespace spot
const state* succ = iter->current_state();
if ((min_ce->size() == 0) ||
if (min_ce->empty() ||
((int)stack.size() + 1 <= min_ce->size()))
{
int depth = in_stack(succ, os);
@ -750,7 +750,7 @@ namespace spot
}
else if ((h_lenght[succ] > (int)stack.size() + 1) &&
(min_ce->size() != 0))
!min_ce->empty())
{
s = succ;
iter->next();
@ -832,7 +832,7 @@ namespace spot
const state* succ = iter->current_state();
if ((min_ce->size() == 0) ||
if (min_ce->empty() ||
((int)stack.size() + 1 <= min_ce->size()))
{
int depth = in_stack(succ, os);
@ -872,7 +872,7 @@ namespace spot
recurse_find(succ, os, mode);
}
else if ((h_lenght[succ] > (int)stack.size() + 1) &&
(min_ce->size() != 0))
!min_ce->empty())
{
//std::cout << "recurse 3 : " << stack.size() << " ";
mode = careful;
@ -946,7 +946,7 @@ namespace spot
//std::cout << os.str() << "save counter" << std::endl;
nb_found++;
if (!min_ce->size())
if (min_ce->empty())
delete min_ce;
min_ce = new ce::counter_example(a);

View file

@ -72,7 +72,7 @@ namespace spot
// We take the max of the progress measure of the successor node
// because we are on a spoiler.
if (lnode_succ->size() == 0)
if (lnode_succ->empty())
progress_measure_ = nb_spoiler_loose_ + 1;
if (progress_measure_ >= nb_spoiler_loose_ + 1)
@ -229,7 +229,7 @@ namespace spot
// We take the min of the progress measure of the successor node
// because we are on a duplicator.
if (lnode_succ->size() == 0)
if (lnode_succ->empty())
progress_measure_ = nb_spoiler_loose_ + 1;
if (progress_measure_ >= nb_spoiler_loose_ + 1)