summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/corelib/tools
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-06-05 00:41:36 +0200
committerThiago Macieira <thiago.macieira@intel.com>2016-06-09 15:32:14 +0000
commit0a78d918f0f411e0da2242a84a396f169154f5d6 (patch)
tree891bd0591f94bd390e12d71ef524ee19fb0d0f72 /tests/benchmarks/corelib/tools
parent43ff604f9453edb24154c2ab5ea72bafe0fc501d (diff)
Replace qAllocMore with a pair of more useful functions
The first is "exact", not "more": qCalculateBlockSize. It ensures that there's no overflow in multiplying, adding the header size or when converting back to an int. The second is the replacement for qAllocMore: it calculates the block size like the first, but increases the block size to accommodate future appends. The number of elements that fit in the block is also returned. Task-number: QTBUG-41230 Change-Id: I52dd43c12685407bb9a6ffff13f5da09f816e667 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/benchmarks/corelib/tools')
-rw-r--r--tests/benchmarks/corelib/tools/qvector/outofline.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/benchmarks/corelib/tools/qvector/outofline.cpp b/tests/benchmarks/corelib/tools/qvector/outofline.cpp
index efd3df2308..76a4edaa10 100644
--- a/tests/benchmarks/corelib/tools/qvector/outofline.cpp
+++ b/tests/benchmarks/corelib/tools/qvector/outofline.cpp
@@ -97,5 +97,5 @@ void QVectorData::free(QVectorData *x, int alignment)
int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT)
{
- return qAllocMore(size * sizeOfT, sizeOfHeader) / sizeOfT;
+ return qCalculateGrowingBlockSize(size, sizeOfT, sizeOfHeader).elementCount;
}