summaryrefslogtreecommitdiff
path: root/src/compositor/compositor_api/qwaylandview.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-05-17 11:07:02 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-05-21 10:48:37 +0200
commit5f2e1d94c07c3d4d2f0f24598f8ab385fad3b74c (patch)
tree9fbf0dadcbee835e367952aff84e41055de9f230 /src/compositor/compositor_api/qwaylandview.cpp
parent7107f7501df329cf785cec1585767e5d7cbab6c2 (diff)
downloadqtwayland-5f2e1d94c07c3d4d2f0f24598f8ab385fad3b74c.tar.gz
Eradicate Q_FOREACH loops [1/2]: trivial cases
In this patch, we port Q_FOREACH loops to C++11 ranged-for loops. All cases are trivial in the sense that either the argument is already const or is trivially marked as const, either by qAsConst(), or, in the case of rvalues, by storing to a const auto temporary first. In addition, all loop bodies are clear enough to confirm that the container we iterate over is not changed under iteration. This does not exclude cases where a loop is prematurely exited just after calling a modifier on the container, as that is safe, if not especially elegant. Change-Id: I87a63f07797437d421567d60e52305391a3c4f21 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandview.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandview.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp
index 1a6bf1a6..12889bdf 100644
--- a/src/compositor/compositor_api/qwaylandview.cpp
+++ b/src/compositor/compositor_api/qwaylandview.cpp
@@ -246,7 +246,8 @@ bool QWaylandView::advance()
return false;
if (d->surface && d->surface->primaryView() == this) {
- Q_FOREACH (QWaylandView *view, d->surface->views()) {
+ const auto views = d->surface->views();
+ for (QWaylandView *view : views) {
if (view != this && view->allowDiscardFrontBuffer() && view->d_func()->currentBuffer == d->currentBuffer)
view->discardCurrentBuffer();
}