diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-01-01 17:52:53 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-01-04 15:06:30 +0100 |
commit | d896f78999720d39bfb24c0256dd9f73cdda58e8 (patch) | |
tree | b76019a505cd441cfdd900148229389dc9f59f52 /src/corelib/kernel/qobject.cpp | |
parent | f6b64c3c62a9c9d49133f002d9b59fb00711508d (diff) |
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>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 69f57efb46..52c095491c 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1959,8 +1959,8 @@ void QObject::killTimer(int id) void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QMetaObject &mo, QList<void*> *list, Qt::FindChildOptions options) { - if (!parent || !list) - return; + Q_ASSERT(parent); + Q_ASSERT(list); const QObjectList &children = parent->children(); QObject *obj; 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, const QMetaObject &mo, QList<void*> *list, Qt::FindChildOptions options) { - if (!parent || !list) - return; + Q_ASSERT(parent); + Q_ASSERT(list); const QObjectList &children = parent->children(); QObject *obj; 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) { - if (!parent) - return nullptr; + Q_ASSERT(parent); const QObjectList &children = parent->children(); QObject *obj; int i; |