summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstringalgorithms_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qstringalgorithms_p.h')
-rw-r--r--src/corelib/tools/qstringalgorithms_p.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/corelib/tools/qstringalgorithms_p.h b/src/corelib/tools/qstringalgorithms_p.h
index c5470bc7ad..4bcf697f78 100644
--- a/src/corelib/tools/qstringalgorithms_p.h
+++ b/src/corelib/tools/qstringalgorithms_p.h
@@ -89,14 +89,12 @@ template <typename StringType> struct QStringAlgorithms
static inline void trimmed_helper_positions(const Char *&begin, const Char *&end)
{
+ // skip white space from end
+ while (begin < end && isSpace(end[-1]))
+ --end;
// skip white space from start
while (begin < end && isSpace(*begin))
begin++;
- // skip white space from end
- if (begin < end) {
- while (begin < end && isSpace(end[-1]))
- end--;
- }
}
static inline StringType trimmed_helper(StringType &str)