From ece0c0a5e7e0b18beb58ccd868bde54c7be64f78 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 22 Nov 2019 14:46:58 +0100 Subject: Tidy nullptr usage Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/corelib/thread/qthreadstorage.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/corelib/thread/qthreadstorage.cpp') diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp index fdc484d2d2..464559ffa5 100644 --- a/src/corelib/thread/qthreadstorage.cpp +++ b/src/corelib/thread/qthreadstorage.cpp @@ -116,7 +116,7 @@ void **QThreadStorageData::get() const QThreadData *data = QThreadData::current(); if (!data) { qWarning("QThreadStorage::get: QThreadStorage can only be used with threads started with QThread"); - return 0; + return nullptr; } QVector &tls = data->tls; if (tls.size() <= id) @@ -128,7 +128,7 @@ void **QThreadStorageData::get() const *v, data->thread.loadRelaxed()); - return *v ? v : 0; + return *v ? v : nullptr; } void **QThreadStorageData::set(void *p) @@ -136,7 +136,7 @@ void **QThreadStorageData::set(void *p) QThreadData *data = QThreadData::current(); if (!data) { qWarning("QThreadStorage::set: QThreadStorage can only be used with threads started with QThread"); - return 0; + return nullptr; } QVector &tls = data->tls; if (tls.size() <= id) @@ -144,7 +144,7 @@ void **QThreadStorageData::set(void *p) void *&value = tls[id]; // delete any previous data - if (value != 0) { + if (value != nullptr) { DEBUG_MSG("QThreadStorageData: Deleting previous storage %d, data %p, for thread %p", id, value, @@ -156,7 +156,7 @@ void **QThreadStorageData::set(void *p) locker.unlock(); void *q = value; - value = 0; + value = nullptr; if (destructor) destructor(q); @@ -178,7 +178,7 @@ void QThreadStorageData::finish(void **p) while (!tls->isEmpty()) { void *&value = tls->last(); void *q = value; - value = 0; + value = nullptr; int i = tls->size() - 1; tls->resize(i); -- cgit v1.2.3