Commit 1fbdf0bc authored by Felix Abecassis's avatar Felix Abecassis
Browse files

* src/tgba/taatgba.cc, src/tgba/taatbga.hh: Fix a memory issue on

Darwin.
parent 58d6b791
2010-01-29 Felix Abecassis <felix.abecassis@lrde.epita.fr>
* src/tgba/taatgba.cc, src/tgba/taatbga.hh: Fix a memory issue on
Darwin.
2010-01-25 Damien Lefortier <dam@lrde.epita.fr>
* wrap/python/cgi/ltl2tgba.in, wrap/python/spot.i: Add a new
......
......@@ -246,30 +246,35 @@ namespace spot
// If no contradiction, then look for another transition to
// merge with the new one.
seen_map::iterator i;
std::vector<taa_tgba::transition*>::iterator j;
if (t->condition != bddfalse)
{
for (i = seen_.find(b); i != seen_.end(); ++i)
{
if (*i->second->dst == *t->dst
&& i->second->condition == t->condition)
{
i->second->acceptance_conditions &= t->acceptance_conditions;
break;
}
if (*i->second->dst == *t->dst
&& i->second->acceptance_conditions == t->acceptance_conditions)
i = seen_.find(b);
if (i != seen_.end())
for (j = i->second.begin(); j != i->second.end(); ++j)
{
i->second->condition |= t->condition;
break;
}
taa_tgba::transition* current = *j;
if (*current->dst == *t->dst
&& current->condition == t->condition)
{
current->acceptance_conditions &= t->acceptance_conditions;
break;
}
if (*current->dst == *t->dst
&& current->acceptance_conditions == t->acceptance_conditions)
{
current->condition |= t->condition;
break;
}
}
}
// Mark the new transition as seen and keep it if we have not
// found any contraction and no other transition to merge with,
// or delete it otherwise.
if (t->condition != bddfalse && i == seen_.end())
// found any contradiction and no other transition to merge
// with, or delete it otherwise.
if (t->condition != bddfalse
&& (i == seen_.end() || j == i->second.end()))
{
seen_.insert(std::make_pair(b, t));
seen_[b].push_back(t);
succ_.push_back(t);
}
else
......@@ -296,11 +301,6 @@ namespace spot
taa_succ_iterator::~taa_succ_iterator()
{
for (unsigned i = 0; i < succ_.size(); ++i)
{
delete succ_[i]->dst;
delete succ_[i];
}
for (seen_map::iterator i = seen_.begin(); i != seen_.end();)
{
// Advance the iterator before deleting the state set.
......@@ -308,6 +308,11 @@ namespace spot
++i;
delete s;
}
for (unsigned i = 0; i < succ_.size(); ++i)
{
delete succ_[i]->dst;
delete succ_[i];
}
}
void
......
......@@ -128,9 +128,9 @@ namespace spot
typedef taa_tgba::state::const_iterator iterator;
typedef std::pair<iterator, iterator> iterator_pair;
typedef std::vector<iterator_pair> bounds_t;
typedef Sgi::hash_multimap<
const spot::state_set*, taa_tgba::transition*, state_ptr_hash,
state_ptr_equal> seen_map;
typedef Sgi::hash_map<
const spot::state_set*, std::vector<taa_tgba::transition*>,
state_ptr_hash, state_ptr_equal> seen_map;
struct distance_sort :
public std::binary_function<const iterator_pair&,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment