From b5a3a02d51290c1f93ff9e41fdb38582e49cbfc8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 14 Aug 2014 09:07:37 +0200 Subject: [PATCH] QString::section: scope a variable better Improves code clarity. Change-Id: If77eb644b1505c84783c907333526a4f08bb75a9 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qstring.cpp | 3 +-- 1 file changed, 1 insertion(+), 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 §ion = sections.at(i); const bool empty = section.isEmpty(); if (x >= start) {