summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-08-14 09:07:37 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-04-05 17:02:37 +0000
commitb5a3a02d51290c1f93ff9e41fdb38582e49cbfc8 (patch)
treef86fee59f904a56f7662d5185c51b8da7953c990
parentf1530d0be1ec9b2fc076188b488c6347298c4c28 (diff)
QString::section: scope a variable better
Improves code clarity. Change-Id: If77eb644b1505c84783c907333526a4f08bb75a9 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
-rw-r--r--src/corelib/tools/qstring.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 01fe98f239..7a5f9b3614 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -4019,10 +4019,9 @@ QString QString::section(const QString &sep, int start, int end, SectionFlags fl
if (start >= sectionsSize || end < 0 || start > end)
return QString();
- int x = 0;
QString ret;
int first_i = start, last_i = end;
- for (int i = 0; x <= end && i < sectionsSize; ++i) {
+ for (int x = 0, i = 0; x <= end && i < sectionsSize; ++i) {
const QStringRef &section = sections.at(i);
const bool empty = section.isEmpty();
if (x >= start) {