Commit 89c8bb2a authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Remove double lookups

parent 56ba6610
...@@ -294,18 +294,20 @@ void OutputConfigurationInterface::Private::sendFailed() ...@@ -294,18 +294,20 @@ void OutputConfigurationInterface::Private::sendFailed()
OutputChangeSet* OutputConfigurationInterface::Private::pendingChanges(OutputDeviceInterface *outputdevice) OutputChangeSet* OutputConfigurationInterface::Private::pendingChanges(OutputDeviceInterface *outputdevice)
{ {
if (!changes.keys().contains(outputdevice)) { auto &change = changes[outputdevice];
changes[outputdevice] = new OutputChangeSet(outputdevice, q); if (!change) {
change = new OutputChangeSet(outputdevice, q);
} }
return changes[outputdevice]; return change;
} }
bool OutputConfigurationInterface::Private::hasPendingChanges(OutputDeviceInterface *outputdevice) const bool OutputConfigurationInterface::Private::hasPendingChanges(OutputDeviceInterface *outputdevice) const
{ {
if (!changes.keys().contains(outputdevice)) { auto it = changes.constFind(outputdevice);
if (it == changes.constEnd()) {
return false; return false;
} }
auto c = changes[outputdevice]; auto c = *it;
return c->enabledChanged() || return c->enabledChanged() ||
c->modeChanged() || c->modeChanged() ||
c->transformChanged() || c->transformChanged() ||
......
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