summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydata.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2019-12-03 09:46:56 +0100
committerLars Knoll <lars.knoll@qt.io>2020-07-06 21:30:27 +0200
commitc01804bd1edf00006a76edb1bf33ba9f72a69296 (patch)
tree434271a8968779603667016759b096daf6d5144e /src/corelib/tools/qarraydata.h
parentf8a53388a78ba70ed609df8738db9bc75e99af86 (diff)
Get rid of QArrayData::isMutable()
Change-Id: Ifb6368b83cd12ec3897c6b6b846d71bffa1f74b9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qarraydata.h')
-rw-r--r--src/corelib/tools/qarraydata.h13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index 7624f7ad20..b3b559e222 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -90,17 +90,9 @@ struct Q_CORE_EXPORT QArrayData
return ref_.deref();
}
- // This refers to array data mutability, not "header data" represented by
- // data members in QArrayData. Shared data (array and header) must still
- // follow COW principles.
- bool isMutable() const
- {
- return ref_.loadRelaxed() != -1;
- }
-
bool isStatic() const
{
- return !isMutable();
+ return ref_.loadRelaxed() == -1;
}
bool isShared() const
@@ -113,8 +105,7 @@ struct Q_CORE_EXPORT QArrayData
// detaching is necessary, you should be in a non-const function already
bool needsDetach()
{
- // requires two conditionals
- return !isMutable() || isShared();
+ return ref_.loadRelaxed() > 1;
}
size_t detachCapacity(size_t newSize) const