shell: use `std::copy_if` in `ShellCorona::panelsForScreen`

Consider using std::accumulate algorithm instead of a raw loop. (CWE-398)
in shell/shellcorona.cpp:1148
wilder-5.26
Fushan Wen 4 years ago
parent 6f96fab365
commit 470dcc511b
No known key found for this signature in database
GPG Key ID: 2E48D1487C91DCAA
  1. 8
      shell/shellcorona.cpp

@ -1131,11 +1131,9 @@ PanelView *ShellCorona::panelView(Plasma::Containment *containment) const
QList<PanelView *> ShellCorona::panelsForScreen(QScreen *screen) const
{
QList<PanelView *> ret;
for (PanelView *v : m_panelViews) {
if (v->screenToFollow() == screen) {
ret += v;
}
}
std::copy_if(m_panelViews.cbegin(), m_panelViews.cend(), std::back_inserter(ret), [screen](const PanelView *v) {
return v->screenToFollow() == screen;
});
return ret;
}

Loading…
Cancel
Save