c++11: use for(auto...) to simplify code in src/bin/.
* src/bin/common_finput.cc, src/bin/genltl.cc, src/bin/ltlcross.cc, src/bin/randltl.cc: Simplify.
This commit is contained in:
parent
34e91b7656
commit
557292bd11
4 changed files with 22 additions and 31 deletions
|
|
@ -343,13 +343,14 @@ int
|
|||
job_processor::run()
|
||||
{
|
||||
int error = 0;
|
||||
jobs_t::const_iterator i;
|
||||
for (i = jobs.begin(); i != jobs.end() && !abort_run; ++i)
|
||||
for (auto& j: jobs)
|
||||
{
|
||||
if (!i->file_p)
|
||||
error |= process_string(i->str);
|
||||
if (!j.file_p)
|
||||
error |= process_string(j.str);
|
||||
else
|
||||
error |= process_file(i->str);
|
||||
error |= process_file(j.str);
|
||||
if (abort_run)
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -853,15 +853,14 @@ output_pattern(int pattern, int n)
|
|||
static void
|
||||
run_jobs()
|
||||
{
|
||||
jobs_t::const_iterator i;
|
||||
for (i = jobs.begin(); i != jobs.end(); ++i)
|
||||
for (auto& j: jobs)
|
||||
{
|
||||
int inc = (i->range.max < i->range.min) ? -1 : 1;
|
||||
int n = i->range.min;
|
||||
int inc = (j.range.max < j.range.min) ? -1 : 1;
|
||||
int n = j.range.min;
|
||||
for (;;)
|
||||
{
|
||||
output_pattern(i->pattern, n);
|
||||
if (n == i->range.max)
|
||||
output_pattern(j.pattern, n);
|
||||
if (n == j.range.max)
|
||||
break;
|
||||
n += inc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1161,17 +1161,13 @@ namespace
|
|||
unsigned c = m->scc_count();
|
||||
for (unsigned n = 0; n < c; ++n)
|
||||
if (m->accepting(n))
|
||||
for (auto i: m->states_of(n))
|
||||
{
|
||||
const std::list<const spot::state*>& l = m->states_of(n);
|
||||
for (std::list<const spot::state*>::const_iterator i = l.begin();
|
||||
i != l.end(); ++i)
|
||||
{
|
||||
spot::state* x = aut->project_state(*i, sspace);
|
||||
spot::state* x = aut->project_state(i, sspace);
|
||||
if (!s.insert(x).second)
|
||||
x->destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
consistency_check(const spot::scc_map* pos, const spot::scc_map* neg,
|
||||
|
|
@ -1183,9 +1179,8 @@ namespace
|
|||
states_in_acc(pos, sspace, s);
|
||||
states_in_acc(neg, sspace, s);
|
||||
bool res = s.size() == states;
|
||||
state_set::iterator it;
|
||||
for (it = s.begin(); it != s.end(); ++it)
|
||||
(*it)->destroy();
|
||||
for (auto i: s)
|
||||
i->destroy();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,11 +160,10 @@ const spot::ltl::formula*
|
|||
GF_n(spot::ltl::atomic_prop_set& ap)
|
||||
{
|
||||
const spot::ltl::formula* res = 0;
|
||||
spot::ltl::atomic_prop_set::const_iterator i;
|
||||
for (i = ap.begin(); i != ap.end(); ++i)
|
||||
for (auto v: ap)
|
||||
{
|
||||
const spot::ltl::formula* f =
|
||||
spot::ltl::unop::instance(spot::ltl::unop::F, (*i)->clone());
|
||||
spot::ltl::unop::instance(spot::ltl::unop::F, v->clone());
|
||||
f = spot::ltl::unop::instance(spot::ltl::unop::G, f);
|
||||
if (res)
|
||||
res = spot::ltl::multop::instance(spot::ltl::multop::And, f, res);
|
||||
|
|
@ -406,11 +405,8 @@ main(int argc, char** argv)
|
|||
|
||||
delete rf;
|
||||
// Cleanup the unicity table.
|
||||
{
|
||||
fset_t::const_iterator i;
|
||||
for (i = unique_set.begin(); i != unique_set.end(); ++i)
|
||||
(*i)->destroy();
|
||||
}
|
||||
for (auto i: unique_set)
|
||||
i->destroy();
|
||||
// Cleanup the atomic_prop set.
|
||||
destroy_atomic_prop_set(aprops);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue