summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydata.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-10-30 14:21:34 +0100
committerLars Knoll <lars.knoll@qt.io>2020-11-04 11:21:46 +0100
commitb76fbb48fba51df95d1776b8c1ff358789d78031 (patch)
tree1955e13a6498318d8d485805af1558d995924829 /src/corelib/tools/qarraydata.cpp
parent419eaa0679c3867d8d9a3da8845a3015e29800d7 (diff)
Clean up out allocation handling
Get rid of the allocation options inside the flags field of QArrayData, they are really a completely separate thing. Change-Id: I823750ab9e4ca85642a0bd0e471ee79c9cde43fb Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qarraydata.cpp')
-rw-r--r--src/corelib/tools/qarraydata.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp
index 4feb52a710..3217e87cc8 100644
--- a/src/corelib/tools/qarraydata.cpp
+++ b/src/corelib/tools/qarraydata.cpp
@@ -185,7 +185,7 @@ static QArrayData *allocateData(qsizetype allocSize)
}
void *QArrayData::allocate(QArrayData **dptr, qsizetype objectSize, qsizetype alignment,
- qsizetype capacity, ArrayOptions options) noexcept
+ qsizetype capacity, QArrayData::AllocationOption option) noexcept
{
Q_ASSERT(dptr);
// Alignment is a power of two
@@ -208,7 +208,7 @@ void *QArrayData::allocate(QArrayData **dptr, qsizetype objectSize, qsizetype al
}
Q_ASSERT(headerSize > 0);
- qsizetype allocSize = calculateBlockSize(capacity, objectSize, headerSize, (options & (GrowsForward|GrowsBackwards)) ? QArrayData::Grow : QArrayData::KeepSize);
+ qsizetype allocSize = calculateBlockSize(capacity, objectSize, headerSize, option);
allocSize = reserveExtraBytes(allocSize);
if (Q_UNLIKELY(allocSize < 0)) { // handle overflow. cannot allocate reliably
*dptr = nullptr;
@@ -220,7 +220,6 @@ void *QArrayData::allocate(QArrayData **dptr, qsizetype objectSize, qsizetype al
if (header) {
// find where offset should point to so that data() is aligned to alignment bytes
data = QTypedArrayData<void>::dataStart(header, alignment);
- header->flags = options & CapacityReserved;
header->alloc = qsizetype(capacity);
}