summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvector.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-02-17 11:23:41 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-20 17:52:27 +0100
commitebeebe212624b0d6fb87266629dce20ee75391bd (patch)
tree0fba86eea8512979658576ed2a6186a3cca477d2 /src/corelib/tools/qvector.cpp
parentec5eb45cd3e6d60744afd9e4b16e36fbba3eaf05 (diff)
Have QVectorData::grow, take size of header w/ padding
This includes padding necessary to align the data array, but excludes the first element as was done before. Size of header is the interesting piece of information, anyway. This simplifies calculations in a couple of places, harmonizes code with the QRawVector fork and paves the way for further changes in QVector, namely the memory layout. When Q_ALIGNOF is not available, default to pointer-size alignment. This should be honoured by malloc and won't trigger use of more expensive aligned allocation. Change-Id: I504022ac7595f69089cafd96e47a91b874d5771e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qvector.cpp')
-rw-r--r--src/corelib/tools/qvector.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp
index 254dd34771..b70436f907 100644
--- a/src/corelib/tools/qvector.cpp
+++ b/src/corelib/tools/qvector.cpp
@@ -76,9 +76,9 @@ void QVectorData::free(QVectorData *x, int alignment)
::free(x);
}
-int QVectorData::grow(int sizeofTypedData, int size, int sizeofT)
+int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT)
{
- return qAllocMore(size * sizeofT, sizeofTypedData - sizeofT) / sizeofT;
+ return qAllocMore(size * sizeOfT, sizeOfHeader) / sizeOfT;
}
/*!