Don't look up a QChar's digit value more than necessary

It isn't a particularly complex operation, but why waste CPU cycles?

This is the kind of function that should be declared pure/const.

Change-Id: I13f03ef0f87607f7649c66beeb37614a31ef2a10
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
Thiago Macieira 2014-06-19 10:56:50 -07:00
parent 9f0e5d00ab
commit 7e488626ab

View File

@ -6960,15 +6960,18 @@ static ArgEscapeData findArgEscapes(const QString &s)
break;
}
if (c->digitValue() == -1)
int escape = c->digitValue();
if (escape == -1)
continue;
int escape = c->digitValue();
++c;
if (c != uc_end && c->digitValue() != -1) {
escape = (10 * escape) + c->digitValue();
++c;
if (c != uc_end) {
int next_escape = c->digitValue();
if (next_escape != -1) {
escape = (10 * escape) + next_escape;
++c;
}
}
if (escape > d.min_escape)