summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2010-02-18 08:56:11 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2010-02-18 09:39:00 (GMT)
commit4145038db1e87f3438233ea7822a3a81f657c334 (patch)
tree9f29536b2b8d3dc674e46f2791d6fa25e6593882 /src/corelib
parent03ac778172b783d26bb1c7c5d92bdedd045fcc92 (diff)
downloadQt-4145038db1e87f3438233ea7822a3a81f657c334.zip
Qt-4145038db1e87f3438233ea7822a3a81f657c334.tar.gz
Qt-4145038db1e87f3438233ea7822a3a81f657c334.tar.bz2
Revert optimizations to QString::append
This reverts commit 03ac778172b783d26bb1c7c5d92bdedd045fcc92 and commit 02135be18f3c4b1d1525aff6dfe96c9c8521084d. They broke qt on all platforms (e.g. qmake didn't compile on Windows any more).
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qlist.cpp18
-rw-r--r--src/corelib/tools/qlist.h28
2 files changed, 4 insertions, 42 deletions
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index a468c77..ac0dc46 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -154,19 +154,6 @@ QListData::Data *QListData::detach(int alloc)
}
/*!
- * Detaches the QListData by allocating new memory for a list which will be bigger
- * than the copied one and is expected to grow further.
- * Returns the old (shared) data, it is up to the caller to deref() and free()
- * For the new data node_copy needs to be called.
- *
- * \internal
- */
-QListData::Data *QListData::detach_grow(int alloc)
-{
- return detach(grow(alloc));
-}
-
-/*!
* Detaches the QListData by reallocating new memory.
* Returns the old (shared) data, it is up to the caller to deref() and free()
* For the new data node_copy needs to be called.
@@ -609,11 +596,6 @@ void **QListData::erase(void **xi)
\internal
*/
-/*! \fn void QList::detach_grow(int alloc)
-
- \internal
-*/
-
/*! \fn void QList::detachShared()
\internal
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 84c7424..8c75c98 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -73,7 +73,6 @@ struct Q_CORE_EXPORT QListData {
enum { DataHeaderSize = sizeof(Data) - sizeof(void *) };
Data *detach(int alloc);
- Data *detach_grow(int alloc);
Data *detach(); // remove in 5.0
Data *detach2(); // remove in 5.0
Data *detach3(); // remove in 5.0
@@ -122,7 +121,6 @@ public:
inline int size() const { return p.size(); }
inline void detach() { if (d->ref != 1) detach_helper(); }
- inline void detach_grow(int by) { if (d->ref != 1) detach_helper_grow(d->alloc + by); }
inline void detachShared()
{
@@ -335,7 +333,6 @@ public:
#endif
private:
- void detach_helper_grow(int alloc);
void detach_helper(int alloc);
void detach_helper();
void free(QListData::Data *d);
@@ -483,7 +480,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::reserve(int alloc)
template <typename T>
Q_OUTOFLINE_TEMPLATE void QList<T>::append(const T &t)
{
- detach_grow(1);
+ detach();
if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
Node *n = reinterpret_cast<Node *>(p.append());
QT_TRY {
@@ -507,7 +504,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::append(const T &t)
template <typename T>
inline void QList<T>::prepend(const T &t)
{
- detach_grow(1);
+ detach();
if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
Node *n = reinterpret_cast<Node *>(p.prepend());
QT_TRY {
@@ -531,7 +528,7 @@ inline void QList<T>::prepend(const T &t)
template <typename T>
inline void QList<T>::insert(int i, const T &t)
{
- detach_grow(1);
+ detach();
if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
Node *n = reinterpret_cast<Node *>(p.insert(i));
QT_TRY {
@@ -625,23 +622,6 @@ Q_OUTOFLINE_TEMPLATE T QList<T>::value(int i, const T& defaultValue) const
}
template <typename T>
-Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper_grow(int alloc)
-{
- Node *n = reinterpret_cast<Node *>(p.begin());
- QListData::Data *x = p.detach_grow(alloc);
- QT_TRY {
- node_copy(reinterpret_cast<Node *>(p.begin()), reinterpret_cast<Node *>(p.end()), n);
- } QT_CATCH(...) {
- qFree(d);
- d = x;
- QT_RETHROW;
- }
-
- if (!x->ref.deref())
- free(x);
-}
-
-template <typename T>
Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper(int alloc)
{
Node *n = reinterpret_cast<Node *>(p.begin());
@@ -750,7 +730,7 @@ Q_OUTOFLINE_TEMPLATE typename QList<T>::iterator QList<T>::erase(typename QList<
template <typename T>
Q_OUTOFLINE_TEMPLATE QList<T> &QList<T>::operator+=(const QList<T> &l)
{
- detach_grow(l.size());
+ detach();
Node *n = reinterpret_cast<Node *>(p.append2(l.p));
QT_TRY{
node_copy(n, reinterpret_cast<Node *>(p.end()), reinterpret_cast<Node *>(l.p.begin()));