mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Func: Use std::stable_sort() for sorting bodies by priority
Avoids platform/stdlib dependent sorting of bodies with the same priority and the same handler. They should be guaranteed to be executed in load order now.
This commit is contained in:
parent
63aaf91bf7
commit
7ca78ea195
1 changed files with 2 additions and 2 deletions
|
@ -303,7 +303,7 @@ ScriptFunc::ScriptFunc(std::string _name, FuncTypePtr ft, std::vector<StmtPtr> b
|
||||||
bodies.push_back(b);
|
bodies.push_back(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
sort(bodies.begin(), bodies.end());
|
std::stable_sort(bodies.begin(), bodies.end());
|
||||||
|
|
||||||
if ( ! bodies.empty() )
|
if ( ! bodies.empty() )
|
||||||
{
|
{
|
||||||
|
@ -566,7 +566,7 @@ void ScriptFunc::AddBody(StmtPtr new_body, const std::vector<IDPtr>& new_inits,
|
||||||
current_priority = b.priority = priority;
|
current_priority = b.priority = priority;
|
||||||
|
|
||||||
bodies.push_back(b);
|
bodies.push_back(b);
|
||||||
sort(bodies.begin(), bodies.end());
|
std::stable_sort(bodies.begin(), bodies.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptFunc::ReplaceBody(const StmtPtr& old_body, StmtPtr new_body)
|
void ScriptFunc::ReplaceBody(const StmtPtr& old_body, StmtPtr new_body)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue