diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-12-03 12:21:46 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-07-06 21:30:33 +0200 |
commit | fbce2e58e6f29dc8dde5618597d53e1b1007b503 (patch) | |
tree | 836e966a69b532e140bc3d83ad846999adb75e47 /src/corelib/tools/qarraydata.h | |
parent | c01804bd1edf00006a76edb1bf33ba9f72a69296 (diff) |
Get rid of QArrayData::sharedNull()
Remove the last places where those got used and avoid
allocations when we resize to 0.
Change-Id: Ib553f4e7ce7cc24c31da15a55a86d18bdf1cc5c3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qarraydata.h')
-rw-r--r-- | src/corelib/tools/qarraydata.h | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index b3b559e222..fe8827afb8 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -77,24 +77,16 @@ struct Q_CORE_EXPORT QArrayData /// Returns true if sharing took place bool ref() { - if (!isStatic()) - ref_.ref(); + ref_.ref(); return true; } /// Returns false if deallocation is necessary bool deref() { - if (isStatic()) - return true; return ref_.deref(); } - bool isStatic() const - { - return ref_.loadRelaxed() == -1; - } - bool isShared() const { return ref_.loadRelaxed() != 1; @@ -133,14 +125,6 @@ struct Q_CORE_EXPORT QArrayData size_t objectSize, size_t newCapacity, ArrayOptions newOptions = DefaultAllocationFlags) Q_DECL_NOTHROW; static void deallocate(QArrayData *data, size_t objectSize, size_t alignment) noexcept; - - static const QArrayData shared_null[2]; - static QArrayData *sharedNull() noexcept { return const_cast<QArrayData*>(shared_null); } - static void *sharedNullData() - { - QArrayData *const null = const_cast<QArrayData *>(&shared_null[1]); - return null; - } }; Q_DECLARE_OPERATORS_FOR_FLAGS(QArrayData::ArrayOptions) |