summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusinternalfilters.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-08-18 11:57:26 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-09-15 15:55:57 +0000
commit6aa935cd92deb035739e8fea329ca2c4a435de54 (patch)
treea9a3ea43af619a7a89ce39f15ea603747767a9f2 /src/dbus/qdbusinternalfilters.cpp
parent251d6094abf423f96aa0f10921defb4c6a805d14 (diff)
Use QString::fromLatin1() less to avoid string allocations
QString::fromLatin1 always allocates memory, but there are cases where we can avoid/reduce allocations or/and reduce text size, e.g.: QStringBuilder expressions Fix: replace QString::fromLatin1 with QL1S QString::fromLatin1().arg(String) pattern Fix: replace with QStringBuilder Overloaded functions with QL1S arg Fix: replace QString::fromLatin1 with QL1S In rare cases if there is no overloaded function with QL1S and we have deal with string literal, replace QString::fromLatin1 with QStringLiteral. Change-Id: Iabe1a3cc0830f40ef78a0548afa4368583c31def Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/dbus/qdbusinternalfilters.cpp')
-rw-r--r--src/dbus/qdbusinternalfilters.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index ad6b06da23..03e04bb2f5 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -116,8 +116,7 @@ static QString generateSubObjectXml(QObject *object)
for ( ; it != end; ++it) {
QString name = (*it)->objectName();
if (!name.isEmpty() && QDBusUtil::isValidPartOfObjectPath(name))
- retval += QString::fromLatin1(" <node name=\"%1\"/>\n")
- .arg(name);
+ retval += QLatin1String(" <node name=\"") + name + QLatin1String("\"/>\n");
}
return retval;
}
@@ -192,8 +191,7 @@ QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node
node.children.constEnd();
for ( ; it != end; ++it)
if (it->obj || !it->children.isEmpty())
- xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n")
- .arg(it->name);
+ xml_data += QLatin1String(" <node name=\"") + it->name + QLatin1String("\"/>\n");
}
xml_data += QLatin1String("</node>\n");