From b435e3747d2d155dffac3bcbd870fc8b3d00438a Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 23 Feb 2018 16:30:10 +0100 Subject: Save some memory allocations by using the right API Test Plan: tests pass Reviewers: #frameworks, markg Reviewed By: markg Subscribers: markg Tags: #frameworks Differential Revision: https://phabricator.kde.org/D10771 --- src/core/kconfig.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core/kconfig.cpp') diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp index 4dab5e75..c8eb90af 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp @@ -200,13 +200,13 @@ QString KConfigPrivate::expandString(const QString &value) } else if (aValue[nDollarPos + 1] != QLatin1Char('$')) { int nEndPos = nDollarPos + 1; // the next character is not $ - QString aVarName; + QStringRef aVarName; if (aValue[nEndPos] == QLatin1Char('{')) { while ((nEndPos <= aValue.length()) && (aValue[nEndPos] != QLatin1Char('}'))) { nEndPos++; } nEndPos++; - aVarName = aValue.mid(nDollarPos + 2, nEndPos - nDollarPos - 3); + aVarName = aValue.midRef(nDollarPos + 2, nEndPos - nDollarPos - 3); } else { while (nEndPos <= aValue.length() && (aValue[nEndPos].isNumber() || @@ -214,7 +214,7 @@ QString KConfigPrivate::expandString(const QString &value) aValue[nEndPos] == QLatin1Char('_'))) { nEndPos++; } - aVarName = aValue.mid(nDollarPos + 1, nEndPos - nDollarPos - 1); + aVarName = aValue.midRef(nDollarPos + 1, nEndPos - nDollarPos - 1); } QString env; if (!aVarName.isEmpty()) { -- cgit v1.2.1