From c01804bd1edf00006a76edb1bf33ba9f72a69296 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 3 Dec 2019 09:46:56 +0100 Subject: Get rid of QArrayData::isMutable() Change-Id: Ifb6368b83cd12ec3897c6b6b846d71bffa1f74b9 Reviewed-by: Thiago Macieira --- src/corelib/tools/qarraydata.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/corelib/tools/qarraydata.h') 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 -- cgit v1.2.3