summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-03-15 13:25:26 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-03-15 20:13:30 (GMT)
commit835b795c3dd752f11c11178bf52b018ddc76b368 (patch)
tree95cb3db914dde84c2b1aaa59b84c615912f09d44 /src
parentd4d7f3575c229848f08c7df75a1281755d6c41a8 (diff)
downloadQt-835b795c3dd752f11c11178bf52b018ddc76b368.zip
Qt-835b795c3dd752f11c11178bf52b018ddc76b368.tar.gz
Qt-835b795c3dd752f11c11178bf52b018ddc76b368.tar.bz2
detach in fewer cases, remove redundant calculation
Reviewed-by: thiago
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qlist.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index c6dd106..dc8c849 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -636,12 +636,10 @@ inline void QList<T>::move(int from, int to)
template<typename T>
Q_OUTOFLINE_TEMPLATE QList<T> QList<T>::mid(int pos, int alength) const
{
- if (alength < 0)
+ if (alength < 0 || pos + alength > size())
alength = size() - pos;
if (pos == 0 && alength == size())
return *this;
- if (pos + alength > size())
- alength = size() - pos;
QList<T> cpy;
cpy.reserve(alength);
cpy.d->end = alength;