diff options
author | Glenn Watson <glenn.watson@nokia.com> | 2012-06-26 10:01:39 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-26 02:09:21 +0200 |
commit | 9fd34288efdbb5c77d002408dd83bccbd654292f (patch) | |
tree | 44f4e76490c6112e57927acefcbcf869a2997957 /src/qml/qml/ftw | |
parent | c0d780426622d21dc4d87f3a543adf03076faae2 (diff) |
Remove default allocation size for PODVector.
The default increment was 1024, which can waste memory. Remove
the default value so that clients must explicitly set the allocation
increment.
The original bug is no longer relevant, as capture properties are
now stored in a linked list rather than a POD vector.
Task-number: QTBUG-20285
Change-Id: Iadb0b40af19fed36ccc05249461acc7e870dcbc3
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/qml/qml/ftw')
-rw-r--r-- | src/qml/qml/ftw/qpodvector_p.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/qml/ftw/qpodvector_p.h b/src/qml/qml/ftw/qpodvector_p.h index c96692667a..d7f51b43e3 100644 --- a/src/qml/qml/ftw/qpodvector_p.h +++ b/src/qml/qml/ftw/qpodvector_p.h @@ -58,13 +58,13 @@ QT_BEGIN_NAMESPACE -template<class T, int Increment=1024> -class QPODVector +template<class T, int Increment> +class QPODVector { public: QPODVector() : m_count(0), m_capacity(0), m_data(0) {} - ~QPODVector() { if (m_data) ::free(m_data); } + ~QPODVector() { if (m_data) ::free(m_data); } const T &at(int idx) const { return m_data[idx]; @@ -109,8 +109,8 @@ public: int newSize = m_count + count; reserve(newSize); int moveCount = m_count - idx; - if (moveCount) - ::memmove(m_data + idx + count, m_data + idx, + if (moveCount) + ::memmove(m_data + idx + count, m_data + idx, moveCount * sizeof(T)); m_count = newSize; } @@ -118,7 +118,7 @@ public: void remove(int idx, int count = 1) { int moveCount = m_count - (idx + count); if (moveCount) - ::memmove(m_data + idx, m_data + idx + count, + ::memmove(m_data + idx, m_data + idx + count, moveCount * sizeof(T)); m_count -= count; } |