diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-01-12 12:49:02 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-01-17 19:56:41 -0800 |
commit | 86b346823e114ac0b6b1c2ab6065ce53b1393de0 (patch) | |
tree | 567c2eb6c50caca1c438d855b14f53de0b9ab8bd /src/corelib/text/qbytearray.h | |
parent | QMetaType: add a missing check for null d_ptr (diff) | |
download | qtbase-86b346823e114ac0b6b1c2ab6065ce53b1393de0.tar.xz qtbase-86b346823e114ac0b6b1c2ab6065ce53b1393de0.zip |
QString::toLatin1_helper_inplace: simplify the code
Hot function, so help the compiler out. In particular, this removes any
touch to the ref count, so there are no atomic operations or dead code
leading to memory allocations and deallocations.
Change-Id: I0e5f6bec596a4a78bd3bfffd16c9a0fbd8dd2c12
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/text/qbytearray.h')
-rw-r--r-- | src/corelib/text/qbytearray.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index 8989eb27a6..dbbbd2f178 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -473,10 +473,10 @@ public: bool isNull() const noexcept; inline DataPointer &data_ptr() { return d; } - explicit inline QByteArray(const DataPointer &dd) - : d(dd) - { - } +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + explicit inline QByteArray(const DataPointer &dd) : d(dd) {} +#endif + explicit inline QByteArray(DataPointer &&dd) : d(std::move(dd)) {} private: void reallocData(qsizetype alloc, QArrayData::AllocationOption option); |