From b76fbb48fba51df95d1776b8c1ff358789d78031 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 30 Oct 2020 14:21:34 +0100 Subject: 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 Reviewed-by: Thiago Macieira --- src/corelib/tools/qarraydata.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/corelib/tools/qarraydata.cpp') 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::dataStart(header, alignment); - header->flags = options & CapacityReserved; header->alloc = qsizetype(capacity); } -- cgit v1.2.3