diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-06-04 21:36:46 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2019-12-07 14:18:04 +0100 |
commit | 64db4861bfcacc8849e8452b73d5c940d97aefd0 (patch) | |
tree | c39991072737ea1253adf5affb321ca7f4923f79 /src/corelib/text/qbytearray.h | |
parent | bf0b4f332a2f1ec9860c610d98cd27e483869bec (diff) |
Replace QArrayData::capacityReserved with a full flags field
Instead of stealing one bit from the alloc field, let's use a full
32-bit for the flags. The first flag to be in the field is the
CapacityReserved (even though the allocate() function will store some
others there, not relevant for now).
This is done in preparation for the need for more flags necessary
anyway.
Change-Id: I4c997d14743495e0d4558a6fb0a6042eb3d4975d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/corelib/text/qbytearray.h')
-rw-r--r-- | src/corelib/text/qbytearray.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index 4d56cd93fd..2808494407 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -509,9 +509,7 @@ inline void QByteArray::reserve(int asize) if (d->ref.isShared() || uint(asize) + 1u > d->alloc) { reallocData(qMax(uint(size()), uint(asize)) + 1u, d->detachFlags() | Data::CapacityReserved); } else { - // cannot set unconditionally, since d could be the shared_null or - // otherwise static - d->capacityReserved = true; + d->flags |= Data::CapacityReserved; } } @@ -520,9 +518,7 @@ inline void QByteArray::squeeze() if (d->ref.isShared() || uint(d->size) + 1u < d->alloc) { reallocData(uint(d->size) + 1u, d->detachFlags() & ~Data::CapacityReserved); } else { - // cannot set unconditionally, since d could be shared_null or - // otherwise static. - d->capacityReserved = false; + d->flags &= ~Data::CapacityReserved; } } |