Verified Commit 470dcc51 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

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
parent 6f96fab3
......@@ -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;
}
......
Supports Markdown
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