diff options
Diffstat (limited to 'src/corelib/tools/qcache.h')
-rw-r--r-- | src/corelib/tools/qcache.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h index 8c0e7860f7..4fcde46fbc 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<Key, Node>::iterator i = hash.find(key); if (typename QHash<Key, Node>::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; @@ -89,7 +89,7 @@ class QCache Q_DISABLE_COPY(QCache) public: - inline explicit QCache(int maxCost = 100) Q_DECL_NOTHROW; + inline explicit QCache(int maxCost = 100) noexcept; inline ~QCache() { clear(); } inline int maxCost() const { return mx; } @@ -116,13 +116,13 @@ private: }; template <class Key, class T> -inline QCache<Key, T>::QCache(int amaxCost) Q_DECL_NOTHROW - : f(0), l(0), mx(amaxCost), total(0) {} +inline QCache<Key, T>::QCache(int amaxCost) noexcept + : f(nullptr), l(nullptr), mx(amaxCost), total(0) {} template <class Key, class T> inline void QCache<Key,T>::clear() { while (f) { delete f->t; f = f->n; } - hash.clear(); l = 0; total = 0; } + hash.clear(); l = nullptr; total = 0; } template <class Key, class T> inline void QCache<Key,T>::setMaxCost(int m) @@ -153,11 +153,11 @@ inline T *QCache<Key,T>::take(const Key &key) { typename QHash<Key, Node>::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; } |