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
Pick-to: 6.5
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>
bb10
parent
496bd9e975
commit
3a7ddd7274
|
|
@ -502,7 +502,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);
|
||||
}
|
||||
|
||||
|
|
@ -1030,7 +1030,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…
Reference in New Issue