Remove default allocation size for PODVector.
authorGlenn Watson <glenn.watson@nokia.com>
Tue, 26 Jun 2012 00:01:39 +0000 (10:01 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 26 Jun 2012 00:09:21 +0000 (02:09 +0200)
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>
src/qml/qml/ftw/qpodvector_p.h

index c966926..d7f51b4 100644 (file)
 
 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;
     }