PosixZone::parse(): don't reset already-initialized variable

The nameBegin variable was already initialized to pos, so just
increment it in the one case that needs it rather than resetting it in
both branches of the condition.

Change-Id: Ia0d42b604ed21829dc84c27a1907c345f62594d1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
bb10
Edward Welbourne 2022-05-23 16:01:43 +02:00
parent 0a350eaf25
commit 02b11e0623
1 changed files with 1 additions and 2 deletions

View File

@ -483,7 +483,7 @@ PosixZone PosixZone::parse(const char *&pos, const char *end)
Q_ASSERT(pos < end);
if (*pos == '<') {
nameBegin = pos + 1; // skip the '<'
++nameBegin; // skip the '<'
nameEnd = nameBegin;
while (nameEnd < end && *nameEnd != '>') {
// POSIX says only alphanumeric, but we allow anything
@ -491,7 +491,6 @@ PosixZone PosixZone::parse(const char *&pos, const char *end)
}
pos = nameEnd + 1; // skip the '>'
} else {
nameBegin = pos;
nameEnd = nameBegin;
while (nameEnd < end && asciiIsLetter(*nameEnd))
++nameEnd;