summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlist.h
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-04-23 14:14:43 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-05-18 11:34:44 +0200
commitaef03d80f7d9b71dfe777cd7927808d69dac0c27 (patch)
tree8bbf2a4e5ee64ad1eb06e26bba9c45f83b86c1bc /src/corelib/tools/qlist.h
parentf3ad1c329cdaedcee404647e1826dda12bcc34fa (diff)
Optimize ~QList
There is no need to check for d as it must never be 0 And the refcount ins QList::free() is nessecerly 0 since it is checked before the function is called Reviewed-by: ossi
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r--src/corelib/tools/qlist.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 722744cc0c..99c9795974 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -712,7 +712,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper()
template <typename T>
Q_OUTOFLINE_TEMPLATE QList<T>::~QList()
{
- if (d && !d->ref.deref())
+ if (!d->ref.deref())
free(d);
}
@@ -740,8 +740,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::free(QListData::Data *data)
{
node_destruct(reinterpret_cast<Node *>(data->array + data->begin),
reinterpret_cast<Node *>(data->array + data->end));
- if (data->ref == 0)
- qFree(data);
+ qFree(data);
}