From 41e7b71c410b77a81d09d3cc2e169ffd7975b4d2 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Tue, 12 Mar 2019 11:46:26 +0100 Subject: 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 Reviewed-by: Simon Hausmann --- src/corelib/tools/qcache.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/corelib/tools/qcache.h') diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h index 8c0e7860f7..b558a8358d 100644 --- a/src/corelib/tools/qcache.h +++ b/src/corelib/tools/qcache.h @@ -51,7 +51,7 @@ class QCache struct Node { inline Node() : keyPtr(0) {} inline Node(T *data, int cost) - : keyPtr(0), t(data), c(cost), p(0), n(0) {} + : keyPtr(nullptr), t(data), c(cost), p(nullptr), n(nullptr) {} const Key *keyPtr; T *t; int c; Node *p,*n; }; Node *f, *l; @@ -71,14 +71,14 @@ class QCache inline T *relink(const Key &key) { typename QHash::iterator i = hash.find(key); if (typename QHash::const_iterator(i) == hash.constEnd()) - return 0; + return nullptr; Node &n = *i; if (f != &n) { if (n.p) n.p->n = n.n; if (n.n) n.n->p = n.p; if (l == &n) l = n.p; - n.p = 0; + n.p = nullptr; n.n = f; f->p = &n; f = &n; @@ -117,12 +117,12 @@ private: template inline QCache::QCache(int amaxCost) Q_DECL_NOTHROW - : f(0), l(0), mx(amaxCost), total(0) {} + : f(nullptr), l(nullptr), mx(amaxCost), total(0) {} template inline void QCache::clear() { while (f) { delete f->t; f = f->n; } - hash.clear(); l = 0; total = 0; } + hash.clear(); l = nullptr; total = 0; } template inline void QCache::setMaxCost(int m) @@ -153,11 +153,11 @@ inline T *QCache::take(const Key &key) { typename QHash::iterator i = hash.find(key); if (i == hash.end()) - return 0; + return nullptr; Node &n = *i; T *t = n.t; - n.t = 0; + n.t = nullptr; unlink(n); return t; } -- cgit v1.2.3