From f083830b8de106ed51d39242008215e9ea2179b2 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Wed, 13 Apr 2016 14:45:11 +0300 Subject: CoreLib: use const (and const APIs) more For CoW types const methods will be called. Mark store_persistent_indexes() as const, because this method does not modify the object. Change-Id: Ic867913b4fb5aaebfbaaffe1d3be45cf7b646403 Reviewed-by: Thiago Macieira --- src/corelib/thread/qthread_p.h | 2 +- src/corelib/thread/qthreadpool.cpp | 2 +- src/corelib/thread/qwaitcondition_win.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 5f7d01f50f..adcd98b609 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -121,7 +121,7 @@ public: void addEvent(const QPostEvent &ev) { int priority = ev.priority; if (isEmpty() || - last().priority >= priority || + constLast().priority >= priority || insertionOffset >= size()) { // optimization: we can simply append if the last event in // the queue has higher or equal priority diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index 9230854600..7ce757064f 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -228,7 +228,7 @@ int QThreadPoolPrivate::activeThreadCount() const void QThreadPoolPrivate::tryToStartMoreThreads() { // try to push tasks on the queue to any available threads - while (!queue.isEmpty() && tryStart(queue.first().first)) + while (!queue.isEmpty() && tryStart(queue.constFirst().first)) queue.removeFirst(); } diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp index f3a645c504..a95ca0b8fd 100644 --- a/src/corelib/thread/qwaitcondition_win.cpp +++ b/src/corelib/thread/qwaitcondition_win.cpp @@ -141,7 +141,7 @@ void QWaitConditionPrivate::post(QWaitConditionEvent *wce, bool ret) // wakeups delivered after the timeout should be forwarded to the next waiter if (!ret && wce->wokenUp && !queue.isEmpty()) { - QWaitConditionEvent *other = queue.first(); + QWaitConditionEvent *other = queue.constFirst(); SetEvent(other->event); other->wokenUp = true; } -- cgit v1.2.3