expansions: fix sort behavior

The previous implementation was wrong and led to segfaults when sorting
large expansions
This commit is contained in:
Antoine Martin 2025-03-07 11:24:00 +01:00
parent 980dc72678
commit b93fb41af2
2 changed files with 6 additions and 14 deletions

View file

@ -504,13 +504,9 @@ namespace spot
{
std::sort(exp.begin(), exp.end(),
[](const auto& lhs, const auto& rhs) {
bdd_less_than_stable blt;
// first sort by label, then by suffix
if (blt(lhs.first, rhs.first))
return true;
formula_ptr_less_than_bool_first flt;
return flt(lhs.second, rhs.second);
});
return std::make_pair(lhs.first.id(), lhs.second.id())
< std::make_pair(rhs.first.id(), rhs.second.id());
});
exp.erase(std::unique(exp.begin(), exp.end()), exp.end());
}
}

View file

@ -503,13 +503,9 @@ namespace spot
{
std::sort(exp.begin(), exp.end(),
[](const auto& lhs, const auto& rhs) {
bdd_less_than_stable blt;
// first sort by label, then by suffix
if (blt(lhs.first, rhs.first))
return true;
formula_ptr_less_than_bool_first flt;
return flt(lhs.second, rhs.second);
});
return std::make_pair(lhs.first.id(), lhs.second.id())
< std::make_pair(rhs.first.id(), rhs.second.id());
});
exp.erase(std::unique(exp.begin(), exp.end()), exp.end());
}
}