diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-12-29 14:35:34 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-12-30 12:05:09 +0000 |
commit | 08adcc62a76b39401c91cbfa7e9f721f0aa5b7f6 (patch) | |
tree | c0ac43e4f4087b571f86c8b7b838e79e5de44450 /src | |
parent | d681107f1fcbaabe7da27ac51563434b81b95d8e (diff) |
QComboBox: use NRVO from QAIM::match() and prevent a detach attempt
Receiving the QStringList return value through RVO instead of
move-assigning it saves 48b in text size on optimized GCC 4.9
Linux AMD 64 builds.
Marking the QStringList const saves another 112b because the
following first() doesn't need to attempt a detach.
Change-Id: If6f25399e80de12114ce41c557bff6ee8c24938b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 565fc7c428..c442ace476 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1548,9 +1548,8 @@ void QComboBox::setDuplicatesEnabled(bool enable) int QComboBox::findData(const QVariant &data, int role, Qt::MatchFlags flags) const { Q_D(const QComboBox); - QModelIndexList result; QModelIndex start = d->model->index(0, d->modelColumn, d->root); - result = d->model->match(start, role, data, 1, flags); + const QModelIndexList result = d->model->match(start, role, data, 1, flags); if (result.isEmpty()) return -1; return result.first().row(); |