diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-05-09 13:31:40 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-05-14 16:02:08 +0000 |
commit | c781a2b4aa07b2f245d04e62eb066cc468285dd6 (patch) | |
tree | 8b3e5a021607361d32003ce143cdcd74665f57ed /src/render/backend/stringtoint.cpp | |
parent | 8ac9e30bb13ee09de71fe07ca85d89d8f6605da9 (diff) |
StringToInt: add an overload taking QLatin1String
About 50% of callers pass static string literals,
which can be converted from QStringLiteral to
QLatin1String if by adding the overload.
Because of the complicated logic in the existing
overload, no attempt is made in this commit to
hand down the QLatin1String until the actual
comparison. Instead, the QString overload is
called, for now.
Saves almost 1KiB in text size in Render on
optimized GCC 6.0 Linux AMD64 builds.
Change-Id: I37ed154ec49349f251b6a4515c20eb7cb5c89181
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/backend/stringtoint.cpp')
-rw-r--r-- | src/render/backend/stringtoint.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/render/backend/stringtoint.cpp b/src/render/backend/stringtoint.cpp index 2b5a0bb83..0be5dcd1f 100644 --- a/src/render/backend/stringtoint.cpp +++ b/src/render/backend/stringtoint.cpp @@ -58,6 +58,12 @@ QVector<QString> StringToInt::m_stringsArray = QVector<QString>(); QVector<QString> StringToInt::m_pendingStringsArray = QVector<QString>(); int StringToInt::m_calls = 0; +int StringToInt::lookupId(QLatin1String str) +{ + // ### optimize me + return lookupId(QString(str)); +} + int StringToInt::lookupId(const QString &str) { // Note: how do we protect against the case where |