QVariant: simplify condition guarding customClear() calls
Due to short-cut evaluation of the built-in op||, we can do the following transformation: - (X && Y) || !X + !X || Y Change-Id: Ia5ae1dd60bdb663aa4648c09372be1598591110d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 3a7ddd7274d93012a57fbe2e47185d921b7a66d1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
9832fb96f6
commit
cc85796174
@ -570,7 +570,7 @@ void QVariant::create(QMetaType type, const void *copy)
|
||||
|
||||
QVariant::~QVariant()
|
||||
{
|
||||
if ((d.is_shared && !d.data.shared->ref.deref()) || (!d.is_shared))
|
||||
if (!d.is_shared || !d.data.shared->ref.deref())
|
||||
customClear(&d);
|
||||
}
|
||||
|
||||
@ -1061,7 +1061,7 @@ const char *QVariant::typeName() const
|
||||
*/
|
||||
void QVariant::clear()
|
||||
{
|
||||
if ((d.is_shared && !d.data.shared->ref.deref()) || (!d.is_shared))
|
||||
if (!d.is_shared || !d.data.shared->ref.deref())
|
||||
customClear(&d);
|
||||
d = {};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user