QByteArray: inline QByteArray::isNull()

Keeping it out-of-line is unnecessary and has been since 5.0. In Qt 4.x,
it was necessary to compare to the shared_null, which for QByteArray was
a static variable. The one for QString has always been inline because
the shared null was a static member of QString (in Qt 3, QString::null
was a QString variable).

See:
https://code.qt.io/cgit/qt/qt.git/tree/src/corelib/tools/qbytearray.cpp#n3249
https://code.qt.io/cgit/qt/qt.git/tree/src/corelib/tools/qstring.h#n505

Change-Id: I89c4eb48af38408daa7cfffd16fdd7696520f1b6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 999654fec7660cd5a724df26a4bc9f54e117a1b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2022-07-01 16:11:25 -07:00 committed by Qt Cherry-pick Bot
parent c4cea61cea
commit 22a4fc0e38
3 changed files with 10 additions and 5 deletions

View File

@ -161,6 +161,8 @@ QByteArray QUrl::toAce(const QString &domain)
#if QT_CORE_REMOVED_SINCE(6, 4)
#include "qbytearray.h" // uses QT_CORE_INLINE_SINCE
#include "qcalendar.h"
QCalendar::QCalendar(QStringView name)

View File

@ -3480,11 +3480,6 @@ QByteArray QByteArray::rightJustified(qsizetype width, char fill, bool truncate)
return result;
}
bool QByteArray::isNull() const noexcept
{
return d->isNull();
}
auto QtPrivate::toSignedInteger(QByteArrayView data, int base) -> ParsedNumber<qlonglong>
{
#if defined(QT_CHECK_RANGE)

View File

@ -439,6 +439,7 @@ public:
inline qsizetype count() const noexcept { return size(); }
#endif
inline qsizetype length() const noexcept { return size(); }
QT_CORE_INLINE_SINCE(6, 4)
bool isNull() const noexcept;
inline DataPointer &data_ptr() { return d; }
@ -567,6 +568,13 @@ inline QByteArray &QByteArray::setNum(ulong n, int base)
inline QByteArray &QByteArray::setNum(float n, char format, int precision)
{ return setNum(double(n), format, precision); }
#if QT_CORE_INLINE_IMPL_SINCE(6, 4)
bool QByteArray::isNull() const noexcept
{
return d->isNull();
}
#endif
#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QByteArray &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QByteArray &);