summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlinkedlist.h
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2011-09-09 11:10:48 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-26 07:50:20 +0200
commitf8f501ec9853231805097a5dbaf0ea99196e8014 (patch)
tree181a0f1d6f3bc4297a6cb7c42728234649df22c3 /src/corelib/tools/qlinkedlist.h
parent1173d0420e341dc6d38c89e5bc4295a57da7ea74 (diff)
Make QLinkedListData::shared_null const
Similar to QList, QMap, QVector, QByteArray and QString, keep the shared_null in shareable memory and never modify it. Change-Id: I70b484d528c397a9d205b1418b6dc920c69dc725 Reviewed-on: http://codereview.qt-project.org/4532 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src/corelib/tools/qlinkedlist.h')
-rw-r--r--src/corelib/tools/qlinkedlist.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 9f2834a7d7..bcad210d30 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -43,7 +43,7 @@
#define QLINKEDLIST_H
#include <QtCore/qiterator.h>
-#include <QtCore/qatomic.h>
+#include <QtCore/qrefcount.h>
#ifndef QT_NO_STL
#include <iterator>
@@ -59,11 +59,11 @@ QT_MODULE(Core)
struct Q_CORE_EXPORT QLinkedListData
{
QLinkedListData *n, *p;
- QBasicAtomicInt ref;
+ QtPrivate::RefCount ref;
int size;
uint sharable : 1;
- static QLinkedListData shared_null;
+ static const QLinkedListData shared_null;
};
template <typename T>
@@ -81,7 +81,7 @@ class QLinkedList
union { QLinkedListData *d; QLinkedListNode<T> *e; };
public:
- inline QLinkedList() : d(&QLinkedListData::shared_null) { d->ref.ref(); }
+ inline QLinkedList() : d(const_cast<QLinkedListData *>(&QLinkedListData::shared_null)) { }
inline QLinkedList(const QLinkedList<T> &l) : d(l.d) { d->ref.ref(); if (!d->sharable) detach(); }
~QLinkedList();
QLinkedList<T> &operator=(const QLinkedList<T> &);