Recombine both variants of Interface::updatePriority()

As only the InterfaceState* variant is actually called,
we can drop the splitting introduced for performance reasons in
29d1e44c5d
This commit is contained in:
Robert Haschke 2021-11-21 04:40:33 +01:00
parent ffb8598363
commit 9d37495c0b
2 changed files with 1 additions and 6 deletions

View File

@ -210,8 +210,6 @@ public:
/// update state's priority (and call notify_ if it really has changed)
void updatePriority(InterfaceState* state, const InterfaceState::Priority& priority);
/// more efficient variant of the above, because we can skip searching the state
void updatePriority(Interface::iterator it, const InterfaceState::Priority& priority);
private:
const NotifyFunction notify_;

View File

@ -142,11 +142,8 @@ void Interface::updatePriority(InterfaceState* state, const InterfaceState::Prio
auto it = std::find(begin(), end(), state); // find iterator to state
assert(it != end()); // state should be part of this interface
updatePriority(it, priority);
}
void Interface::updatePriority(Interface::iterator it, const InterfaceState::Priority& priority) {
it->priority_ = priority; // update priority
state->priority_ = priority; // update priority
update(it); // update position in ordered list
if (notify_)
notify_(it, true); // notify callback