* src/misc/freelist.cc (free_list::remove): Work around

invalidated iterators.
* tgba/bdddict.cc (unregister_variable): New methods,
extracted from ...
(bdd_dict::unregister_all_my_variables): ... here.
* tgba/bdddict.hh (unregister_variable): Declare them.
This commit is contained in:
Alexandre Duret-Lutz 2004-03-25 15:02:57 +00:00
parent 784ccafb1b
commit 3c3b23bfa4
4 changed files with 90 additions and 60 deletions

View file

@ -131,13 +131,15 @@ namespace spot
void
free_list::remove(int base, int n)
{
free_list_type::iterator cur;
free_list_type::iterator cur = fl.begin();
int end = base + n;
for (cur = fl.begin(); cur != fl.end() && cur->first <= end; ++cur)
while (cur != fl.end() && cur->first <= end)
{
int cend = cur->first + cur->second;
// Remove may invalidate the current iterator, so advance it first.
free_list_type::iterator old = cur++;
if (cend >= end)
remove(cur, base, std::max(n, cend - base));
remove(old, base, std::max(n, cend - base));
}
}