Changeset View
Changeset View
Standalone View
Standalone View
shell/screenpool.cpp
Show First 20 Lines • Show All 165 Lines • ▼ Show 20 Line(s) | 163 | { | |||
---|---|---|---|---|---|
166 | return m_connectorForId.value(id); | 166 | return m_connectorForId.value(id); | ||
167 | } | 167 | } | ||
168 | 168 | | |||
169 | int ScreenPool::firstAvailableId() const | 169 | int ScreenPool::firstAvailableId() const | ||
170 | { | 170 | { | ||
171 | int i = 0; | 171 | int i = 0; | ||
172 | //find the first integer not stored in m_connectorForId | 172 | //find the first integer not stored in m_connectorForId | ||
173 | //m_connectorForId is the only map, so the ids are sorted | 173 | //m_connectorForId is the only map, so the ids are sorted | ||
174 | foreach (int existingId, m_connectorForId.keys()) { | 174 | const auto keys = m_connectorForId.keys(); | ||
apol: Iterating through keys isn't very optimal, I'd use iterators here. | |||||
nicolasfella: Agreed, but in another patch | |||||
175 | for (int existingId : keys) { | ||||
175 | if (i != existingId) { | 176 | if (i != existingId) { | ||
176 | return i; | 177 | return i; | ||
177 | } | 178 | } | ||
178 | ++i; | 179 | ++i; | ||
179 | } | 180 | } | ||
180 | 181 | | |||
181 | return i; | 182 | return i; | ||
182 | } | 183 | } | ||
Show All 40 Lines |
Iterating through keys isn't very optimal, I'd use iterators here.