qt_qFindChild(ren)_helper: remove pointless checks

The only callers are QObject::findChild(ren), and they always
pass valid pointers, so there's no point of checking them.

Change-Id: I789abc3a53db523acf06c1a8a340094a71c79e41
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2021-01-01 17:52:53 +01:00
parent f6b64c3c62
commit d896f78999

View File

@ -1959,8 +1959,8 @@ void QObject::killTimer(int id)
void qt_qFindChildren_helper(const QObject *parent, const QString &name, void qt_qFindChildren_helper(const QObject *parent, const QString &name,
const QMetaObject &mo, QList<void*> *list, Qt::FindChildOptions options) const QMetaObject &mo, QList<void*> *list, Qt::FindChildOptions options)
{ {
if (!parent || !list) Q_ASSERT(parent);
return; Q_ASSERT(list);
const QObjectList &children = parent->children(); const QObjectList &children = parent->children();
QObject *obj; QObject *obj;
for (int i = 0; i < children.size(); ++i) { for (int i = 0; i < children.size(); ++i) {
@ -1981,8 +1981,8 @@ void qt_qFindChildren_helper(const QObject *parent, const QString &name,
void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re, void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re,
const QMetaObject &mo, QList<void*> *list, Qt::FindChildOptions options) const QMetaObject &mo, QList<void*> *list, Qt::FindChildOptions options)
{ {
if (!parent || !list) Q_ASSERT(parent);
return; Q_ASSERT(list);
const QObjectList &children = parent->children(); const QObjectList &children = parent->children();
QObject *obj; QObject *obj;
for (int i = 0; i < children.size(); ++i) { for (int i = 0; i < children.size(); ++i) {
@ -2003,8 +2003,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re
*/ */
QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options) QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options)
{ {
if (!parent) Q_ASSERT(parent);
return nullptr;
const QObjectList &children = parent->children(); const QObjectList &children = parent->children();
QObject *obj; QObject *obj;
int i; int i;