diff options
author | Kevin Funk <kevin.funk@kdab.com> | 2019-03-12 11:46:26 +0100 |
---|---|---|
committer | Kevin Funk <kevin.funk@kdab.com> | 2019-03-14 07:37:52 +0000 |
commit | 41e7b71c410b77a81d09d3cc2e169ffd7975b4d2 (patch) | |
tree | fd0722a70d1aedf8567cc11babd10adcbbd1e797 /src/corelib/thread | |
parent | b35eec360d4d88d094094fb54c101fad6cee5768 (diff) |
More nullptr usage in headers
Diff generated by running clang-tidy's modernize-use-nullptr checker on
the CMake-based Qt version.
Skipping src/3rdparty, examples/, tests/
Change-Id: Ib182074e2e2fd52f63093f73b3e2e4c0cb7af188
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r-- | src/corelib/thread/qatomic_bootstrap.h | 2 | ||||
-rw-r--r-- | src/corelib/thread/qresultstore.h | 4 | ||||
-rw-r--r-- | src/corelib/thread/qthread_p.h | 12 | ||||
-rw-r--r-- | src/corelib/thread/qthreadpool_p.h | 2 | ||||
-rw-r--r-- | src/corelib/thread/qthreadstorage.h | 4 |
5 files changed, 12 insertions, 12 deletions
diff --git a/src/corelib/thread/qatomic_bootstrap.h b/src/corelib/thread/qatomic_bootstrap.h index b463f817bd..27a67fb2ee 100644 --- a/src/corelib/thread/qatomic_bootstrap.h +++ b/src/corelib/thread/qatomic_bootstrap.h @@ -65,7 +65,7 @@ template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> > return --_q_value != 0; } - static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue = 0) Q_DECL_NOTHROW + static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW { if (currentValue) *currentValue = _q_value; diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h index 1f29e8d187..7a65089396 100644 --- a/src/corelib/thread/qresultstore.h +++ b/src/corelib/thread/qresultstore.h @@ -142,7 +142,7 @@ public: template <typename T> int addResult(int index, const T *result) { - if (result == 0) + if (result == nullptr) return addResult(index, static_cast<void *>(nullptr)); else return addResult(index, static_cast<void *>(new T(*result))); @@ -158,7 +158,7 @@ public: int addResults(int index, const QVector<T> *results, int totalCount) { if (m_filterMode == true && results->count() != totalCount && 0 == results->count()) - return addResults(index, 0, 0, totalCount); + return addResults(index, nullptr, 0, totalCount); else return addResults(index, new QVector<T>(*results), results->count(), totalCount); } diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 7d9442ab79..e614ddd004 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -89,7 +89,7 @@ public: QEvent *event; int priority; inline QPostEvent() - : receiver(0), event(0), priority(0) + : receiver(nullptr), event(nullptr), priority(0) { } inline QPostEvent(QObject *r, QEvent *e, int p) : receiver(r), event(e), priority(p) @@ -148,7 +148,7 @@ private: class Q_CORE_EXPORT QDaemonThread : public QThread { public: - QDaemonThread(QObject *parent = 0); + QDaemonThread(QObject *parent = nullptr); ~QDaemonThread(); }; @@ -157,7 +157,7 @@ class QThreadPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QThread) public: - QThreadPrivate(QThreadData *d = 0); + QThreadPrivate(QThreadData *d = nullptr); ~QThreadPrivate(); void setPriority(QThread::Priority prio); @@ -248,7 +248,7 @@ public: #endif static void clearCurrentThreadData(); static QThreadData *get2(QThread *thread) - { Q_ASSERT_X(thread != 0, "QThread", "internal error"); return thread->d_func()->data; } + { Q_ASSERT_X(thread != nullptr, "QThread", "internal error"); return thread->d_func()->data; } void ref(); @@ -281,7 +281,7 @@ public: public: FlaggedDebugSignatures() : idx(0) - { std::fill_n(locations, Count, static_cast<char*>(0)); } + { std::fill_n(locations, Count, static_cast<char*>(nullptr)); } void store(const char* method) { locations[idx++ % Count] = method; } @@ -328,7 +328,7 @@ class QAdoptedThread : public QThread Q_DECLARE_PRIVATE(QThread) public: - QAdoptedThread(QThreadData *data = 0); + QAdoptedThread(QThreadData *data = nullptr); ~QAdoptedThread(); void init(); diff --git a/src/corelib/thread/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h index 952e02ef20..01852d8366 100644 --- a/src/corelib/thread/qthreadpool_p.h +++ b/src/corelib/thread/qthreadpool_p.h @@ -162,7 +162,7 @@ public: void tryToStartMoreThreads(); bool tooManyThreadsActive() const; - void startThread(QRunnable *runnable = 0); + void startThread(QRunnable *runnable = nullptr); void reset(); bool waitForDone(int msecs); bool waitForDone(const QDeadlineTimer &timer); diff --git a/src/corelib/thread/qthreadstorage.h b/src/corelib/thread/qthreadstorage.h index 55fc482da3..9eb8672e92 100644 --- a/src/corelib/thread/qthreadstorage.h +++ b/src/corelib/thread/qthreadstorage.h @@ -69,7 +69,7 @@ inline T *&qThreadStorage_localData(QThreadStorageData &d, T **) { void **v = d.get(); - if (!v) v = d.set(0); + if (!v) v = d.set(nullptr); return *(reinterpret_cast<T**>(v)); } @@ -139,7 +139,7 @@ public: inline ~QThreadStorage() { } inline bool hasLocalData() const - { return d.get() != 0; } + { return d.get() != nullptr; } inline T& localData() { return qThreadStorage_localData(d, reinterpret_cast<T*>(0)); } |