]>
Commit | Line | Data |
---|---|---|
18733c60 SS |
1 | diff -up qt-everywhere-opensource-src-4.8.0/src/corelib/tools/qlist.h.QTBUG-22037 qt-everywhere-opensource-src-4.8.0/src/corelib/tools/qlist.h |
2 | --- qt-everywhere-opensource-src-4.8.0/src/corelib/tools/qlist.h.QTBUG-22037 2011-10-03 22:44:32.000000000 -0500 | |
3 | +++ qt-everywhere-opensource-src-4.8.0/src/corelib/tools/qlist.h 2011-10-15 14:25:52.238694974 -0500 | |
4 | @@ -769,26 +769,18 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::clea | |
5 | template <typename T> | |
6 | Q_OUTOFLINE_TEMPLATE int QList<T>::removeAll(const T &_t) | |
7 | { | |
8 | - int index = indexOf(_t); | |
9 | - if (index == -1) | |
10 | - return 0; | |
11 | - | |
12 | + detachShared(); | |
13 | const T t = _t; | |
14 | - detach(); | |
15 | - | |
16 | - Node *i = reinterpret_cast<Node *>(p.at(index)); | |
17 | - Node *e = reinterpret_cast<Node *>(p.end()); | |
18 | - Node *n = i; | |
19 | - node_destruct(i); | |
20 | - while (++i != e) { | |
21 | - if (i->t() == t) | |
22 | - node_destruct(i); | |
23 | - else | |
24 | - *n++ = *i; | |
25 | - } | |
26 | - | |
27 | - int removedCount = e - n; | |
28 | - d->end -= removedCount; | |
29 | + int removedCount=0, i=0; | |
30 | + Node *n; | |
31 | + while (i < p.size()) | |
32 | + if ((n = reinterpret_cast<Node *>(p.at(i)))->t() == t) { | |
33 | + node_destruct(n); | |
34 | + p.remove(i); | |
35 | + ++removedCount; | |
36 | + } else { | |
37 | + ++i; | |
38 | + } | |
39 | return removedCount; | |
40 | } | |
41 |