QtDBus: eradicate all Q_FOREACH loops
Saves a bit more than 0.5KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: I3b7e4751c4799c3e2c9f8f23b769e1659d863579 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
a7d631e44b
commit
0ea39eb842
@ -427,9 +427,9 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
|
||||
int data_size = idata.size() +
|
||||
(header->methodCount * (5+intsPerMethod)) + methodParametersDataSize +
|
||||
(header->propertyCount * (3+intsPerProperty));
|
||||
foreach (const Method &mm, signals_)
|
||||
for (const Method &mm : qAsConst(signals_))
|
||||
data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
|
||||
foreach (const Method &mm, methods)
|
||||
for (const Method &mm : qAsConst(methods))
|
||||
data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
|
||||
idata.resize(data_size + 1);
|
||||
|
||||
|
@ -99,9 +99,8 @@ QDBusServer::~QDBusServer()
|
||||
{
|
||||
if (QDBusConnectionManager::instance()) {
|
||||
QMutexLocker locker(&QDBusConnectionManager::instance()->mutex);
|
||||
Q_FOREACH (const QString &name, d->serverConnectionNames) {
|
||||
for (const QString &name : qAsConst(d->serverConnectionNames))
|
||||
QDBusConnectionManager::instance()->removeConnection(name);
|
||||
}
|
||||
d->serverConnectionNames.clear();
|
||||
}
|
||||
d->ref.store(0);
|
||||
|
@ -78,7 +78,7 @@ void QDBusServiceWatcherPrivate::setConnection(const QStringList &s, const QDBus
|
||||
{
|
||||
if (connection.isConnected()) {
|
||||
// remove older rules
|
||||
foreach (const QString &s, servicesWatched)
|
||||
for (const QString &s : qAsConst(servicesWatched))
|
||||
removeService(s);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ void QDBusServiceWatcherPrivate::setConnection(const QStringList &s, const QDBus
|
||||
|
||||
if (connection.isConnected()) {
|
||||
// add new rules
|
||||
foreach (const QString &s, servicesWatched)
|
||||
for (const QString &s : qAsConst(servicesWatched))
|
||||
addService(s);
|
||||
}
|
||||
}
|
||||
|
@ -77,8 +77,8 @@ static bool variantToString(const QVariant &arg, QString &out)
|
||||
|
||||
if (argType == QVariant::StringList) {
|
||||
out += QLatin1Char('{');
|
||||
QStringList list = arg.toStringList();
|
||||
foreach (const QString &item, list)
|
||||
const QStringList list = arg.toStringList();
|
||||
for (const QString &item : list)
|
||||
out += QLatin1Char('\"') + item + QLatin1String("\", ");
|
||||
if (!list.isEmpty())
|
||||
out.chop(2);
|
||||
@ -95,8 +95,8 @@ static bool variantToString(const QVariant &arg, QString &out)
|
||||
out += QLatin1Char('}');
|
||||
} else if (argType == QVariant::List) {
|
||||
out += QLatin1Char('{');
|
||||
QList<QVariant> list = arg.toList();
|
||||
foreach (const QVariant &item, list) {
|
||||
const QList<QVariant> list = arg.toList();
|
||||
for (const QVariant &item : list) {
|
||||
if (!variantToString(item, out))
|
||||
return false;
|
||||
out += QLatin1String(", ");
|
||||
|
Loading…
Reference in New Issue
Block a user