summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-26 17:42:20 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-26 17:42:20 (GMT)
commit0fa408468327672f7e1ad8c628dc073c43bf2b3f (patch)
tree4eb888ca8a5d2e9d593c4cc904fd77c242e5f27d /src/corelib
parentca82ee4ee55e52c75326949148455af1095df014 (diff)
parented1d9f24d035857438e5bb9ccb423310bc30310b (diff)
downloadQt-0fa408468327672f7e1ad8c628dc073c43bf2b3f.zip
Qt-0fa408468327672f7e1ad8c628dc073c43bf2b3f.tar.gz
Qt-0fa408468327672f7e1ad8c628dc073c43bf2b3f.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/berlin-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/berlin-staging-1: (22 commits) fix "configure -fast" on Windows for other maketools than nmake Get qmake to add pdb files to install target in debug configuration. add TARGET_PLATFORM to qmakespecs with MAKEFILE_GENERATOR = UNIX give symbian an own platform mode deprecate -win32/-unix/-macx which set both host and target mode decouple host platform mode from target platform mode factor out applyHostMode() make QMAKE_QMAKE and QMAKE_EXT_OBJ magic builtins use QDir::separator() instead of Option::dir_sep where appropriate simplify string ops sanitize evaluation of OS scopes instead of hard-coding recursion for symbian, add it to the specs add possibility to request project recursion from within a pro file fix ts-assistant target use QList::reserve() as appropriate optimize appending of (empty) lists to (empty) lists suppress pointer aliasing warnings Fix compilation with namespace. Assistant: Make ~AbstractHelpViewer() virtual. Prepare German translations for 4.7 (except Quick). ...
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qhash.h3
-rw-r--r--src/corelib/tools/qlist.h34
-rw-r--r--src/corelib/tools/qmap.h3
3 files changed, 28 insertions, 12 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index f1030ae..3374c80 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -625,6 +625,7 @@ template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<Key> QHash<Key, T>::uniqueKeys() const
{
QList<Key> res;
+ res.reserve(size()); // May be too much, but assume short lifetime
const_iterator i = begin();
if (i != end()) {
for (;;) {
@@ -644,6 +645,7 @@ template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<Key> QHash<Key, T>::keys() const
{
QList<Key> res;
+ res.reserve(size());
const_iterator i = begin();
while (i != end()) {
res.append(i.key());
@@ -688,6 +690,7 @@ template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<T> QHash<Key, T>::values() const
{
QList<T> res;
+ res.reserve(size());
const_iterator i = begin();
while (i != end()) {
res.append(i.value());
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 3a29e13..c6dd106 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -525,7 +525,8 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::append(const T &t)
PodNode cpy = *reinterpret_cast<const PodNode *>(&t);
Node *n = reinterpret_cast<Node *>(p.append());
QT_TRY {
- node_construct(n, *reinterpret_cast<const T *>(&cpy));
+ void *ptr = &cpy;
+ node_construct(n, *reinterpret_cast<T *>(ptr));
} QT_CATCH(...) {
--d->end;
QT_RETHROW;
@@ -559,7 +560,8 @@ inline void QList<T>::prepend(const T &t)
PodNode cpy = *reinterpret_cast<const PodNode *>(&t);
Node *n = reinterpret_cast<Node *>(p.prepend());
QT_TRY {
- node_construct(n, *reinterpret_cast<const T *>(&cpy));
+ void *ptr = &cpy;
+ node_construct(n, *reinterpret_cast<T *>(ptr));
} QT_CATCH(...) {
++d->begin;
QT_RETHROW;
@@ -593,7 +595,8 @@ inline void QList<T>::insert(int i, const T &t)
PodNode cpy = *reinterpret_cast<const PodNode *>(&t);
Node *n = reinterpret_cast<Node *>(p.insert(i));
QT_TRY {
- node_construct(n, *reinterpret_cast<const T *>(&cpy));
+ void *ptr = &cpy;
+ node_construct(n, *reinterpret_cast<T *>(ptr));
} QT_CATCH(...) {
p.remove(i);
QT_RETHROW;
@@ -808,15 +811,22 @@ 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)
{
- Node *n = (d->ref != 1)
- ? detach_helper_grow(INT_MAX, l.size())
- : reinterpret_cast<Node *>(p.append2(l.p));
- QT_TRY{
- node_copy(n, reinterpret_cast<Node *>(p.end()), reinterpret_cast<Node *>(l.p.begin()));
- } QT_CATCH(...) {
- // restore the old end
- d->end -= int(reinterpret_cast<Node *>(p.end()) - n);
- QT_RETHROW;
+ if (!l.isEmpty()) {
+ if (isEmpty()) {
+ *this = l;
+ } else {
+ Node *n = (d->ref != 1)
+ ? detach_helper_grow(INT_MAX, l.size())
+ : reinterpret_cast<Node *>(p.append2(l.p));
+ QT_TRY {
+ node_copy(n, reinterpret_cast<Node *>(p.end()),
+ reinterpret_cast<Node *>(l.p.begin()));
+ } QT_CATCH(...) {
+ // restore the old end
+ d->end -= int(reinterpret_cast<Node *>(p.end()) - n);
+ QT_RETHROW;
+ }
+ }
}
return *this;
}
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 2e21547..df0ae46 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -773,6 +773,7 @@ template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::uniqueKeys() const
{
QList<Key> res;
+ res.reserve(size()); // May be too much, but assume short lifetime
const_iterator i = begin();
if (i != end()) {
for (;;) {
@@ -792,6 +793,7 @@ template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::keys() const
{
QList<Key> res;
+ res.reserve(size());
const_iterator i = begin();
while (i != end()) {
res.append(i.key());
@@ -836,6 +838,7 @@ template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<T> QMap<Key, T>::values() const
{
QList<T> res;
+ res.reserve(size());
const_iterator i = begin();
while (i != end()) {
res.append(i.value());