зеркало из https://github.com/mozilla/gecko-dev.git
To improve performance, change string iterator postfix ++ to prefix ++ when used as a statement. b=78032 r=peterv, scc, harishd, dmose sr=hyatt a=asa
This commit is contained in:
Родитель
8fd549aded
Коммит
a236696e96
|
@ -119,7 +119,7 @@ void nsStyleLinkElement::ParseLinkTypes(const nsAReadableString& aTypes,
|
|||
inString = PR_TRUE;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
if (inString) {
|
||||
subString = Substring(start, current);
|
||||
|
|
|
@ -962,7 +962,7 @@ nsLDAPService::CountTokens(nsReadingIterator<PRUnichar> aIter,
|
|||
// move past any leading spaces
|
||||
//
|
||||
while (aIter != aIterEnd && nsCRT::IsAsciiSpace(*aIter)) {
|
||||
aIter++;
|
||||
++aIter;
|
||||
}
|
||||
|
||||
// move past all chars in this token
|
||||
|
@ -970,11 +970,11 @@ nsLDAPService::CountTokens(nsReadingIterator<PRUnichar> aIter,
|
|||
while (aIter != aIterEnd) {
|
||||
|
||||
if (nsCRT::IsAsciiSpace(*aIter)) {
|
||||
count++; // token finished; increment the count
|
||||
aIter++; // move past the space
|
||||
++count; // token finished; increment the count
|
||||
++aIter; // move past the space
|
||||
break;
|
||||
}
|
||||
aIter++; // move to next char and continue with this token
|
||||
++aIter; // move to next char and continue with this token
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -992,14 +992,14 @@ nsLDAPService::NextToken(nsReadingIterator<PRUnichar> & aIter,
|
|||
// move past any leading whitespace
|
||||
//
|
||||
while ( aIter != aIterEnd && nsCRT::IsAsciiSpace(*aIter) ) {
|
||||
aIter++;
|
||||
++aIter;
|
||||
}
|
||||
|
||||
// copy the token into our local variable
|
||||
//
|
||||
while ( aIter != aIterEnd && !nsCRT::IsAsciiSpace(*aIter) ) {
|
||||
token.Append(*aIter);
|
||||
aIter++;
|
||||
++aIter;
|
||||
}
|
||||
|
||||
return token.ToNewCString();
|
||||
|
|
|
@ -546,7 +546,7 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag)
|
|||
// be part of this text token (we wouldn't have come here if it weren't)
|
||||
aScanner.CurrentPosition(origin);
|
||||
start = origin;
|
||||
start++;
|
||||
++start;
|
||||
aScanner.SetPosition(start);
|
||||
|
||||
while((NS_OK==result) && (!done)) {
|
||||
|
@ -571,13 +571,13 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag)
|
|||
// If it standalone, replace the "\r" with a "\n" so that
|
||||
// it will be considered by the layout system
|
||||
aScanner.ReplaceCharacter(end, kLF);
|
||||
end++;
|
||||
++end;
|
||||
}
|
||||
mNewlineCount++;
|
||||
++mNewlineCount;
|
||||
break;
|
||||
case kLF:
|
||||
end++;
|
||||
mNewlineCount++;
|
||||
++end;
|
||||
++mNewlineCount;
|
||||
break;
|
||||
} //switch
|
||||
}
|
||||
|
@ -947,17 +947,17 @@ nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32
|
|||
// If it standalone, replace the "\r" with a "\n" so that
|
||||
// it will be considered by the layout system
|
||||
aScanner.ReplaceCharacter(end, kLF);
|
||||
end++;
|
||||
++end;
|
||||
}
|
||||
mNewlineCount++;
|
||||
++mNewlineCount;
|
||||
break;
|
||||
case kLF:
|
||||
end++;
|
||||
mNewlineCount++;
|
||||
++end;
|
||||
++mNewlineCount;
|
||||
break;
|
||||
case '\'':
|
||||
case '"':
|
||||
end++;
|
||||
++end;
|
||||
if (quote) {
|
||||
if (quote == aChar) {
|
||||
quote = 0;
|
||||
|
@ -968,10 +968,10 @@ nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32
|
|||
break;
|
||||
case kGreaterThan:
|
||||
if (quote) {
|
||||
end++;
|
||||
++end;
|
||||
} else {
|
||||
start = end;
|
||||
start++; // Note that start is wrong after this, we just avoid temp var
|
||||
++start; // Note that start is wrong after this, we just avoid temp var
|
||||
aScanner.SetPosition(start); // Skip the >
|
||||
done=PR_TRUE;
|
||||
}
|
||||
|
@ -1125,12 +1125,12 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
|
|||
|
||||
while((NS_OK==result)) {
|
||||
if (FindCharInReadable(PRUnichar(kGreaterThan), theCurrOffset, endPos)) {
|
||||
theCurrOffset++;
|
||||
++theCurrOffset;
|
||||
nsReadingIterator<PRUnichar> temp = theCurrOffset;
|
||||
temp.advance(-3);
|
||||
aChar=*temp;
|
||||
if(kMinus==aChar) {
|
||||
temp++;
|
||||
++temp;
|
||||
aChar=*temp;
|
||||
if(kMinus==aChar) {
|
||||
theStartOffset.advance(-2); // Include "<!" also..
|
||||
|
|
|
@ -549,7 +549,7 @@ nsresult nsScanner::SkipWhitespace(void) {
|
|||
break;
|
||||
}
|
||||
else {
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -738,7 +738,7 @@ nsresult nsScanner::GetIdentifier(nsString& aString,PRBool allowPunct) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -800,7 +800,7 @@ nsresult nsScanner::ReadIdentifier(nsString& aString,PRBool allowPunct) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -858,7 +858,7 @@ nsresult nsScanner::ReadIdentifier(nsReadingIterator<PRUnichar>& aStart,
|
|||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -915,7 +915,7 @@ nsresult nsScanner::ReadNumber(nsString& aString) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -965,7 +965,7 @@ nsresult nsScanner::ReadNumber(nsReadingIterator<PRUnichar>& aStart,
|
|||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -1024,7 +1024,7 @@ nsresult nsScanner::ReadWhitespace(nsString& aString) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
current ++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -1076,7 +1076,7 @@ nsresult nsScanner::ReadWhitespace(nsReadingIterator<PRUnichar>& aStart,
|
|||
break;
|
||||
}
|
||||
|
||||
current ++;
|
||||
++current;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1125,12 +1125,12 @@ nsresult nsScanner::ReadWhile(nsString& aString,
|
|||
PRInt32 pos=aValidSet.FindChar(theChar);
|
||||
if(kNotFound==pos) {
|
||||
if(addTerminal)
|
||||
current++;
|
||||
++current;
|
||||
AppendUnicodeTo(origin, current, aString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -1180,14 +1180,14 @@ nsresult nsScanner::ReadUntil(nsAWritableString& aString,
|
|||
while (*setcurrent) {
|
||||
if (*setcurrent == theChar) {
|
||||
if(addTerminal)
|
||||
current++;
|
||||
++current;
|
||||
AppendUnicodeTo(origin, current, aString);
|
||||
goto found;
|
||||
}
|
||||
setcurrent++;
|
||||
++setcurrent;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
found:
|
||||
|
||||
|
@ -1238,14 +1238,14 @@ nsresult nsScanner::ReadUntil(nsAWritableString& aString,
|
|||
while (*setcurrent) {
|
||||
if (*setcurrent == theChar) {
|
||||
if(addTerminal)
|
||||
current++;
|
||||
++current;
|
||||
AppendUnicodeTo(origin, current, aString);
|
||||
goto found;
|
||||
}
|
||||
setcurrent++;
|
||||
++setcurrent;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
found:
|
||||
|
||||
|
@ -1286,15 +1286,15 @@ nsresult nsScanner::ReadUntil(nsReadingIterator<PRUnichar>& aStart,
|
|||
while (*setcurrent) {
|
||||
if (*setcurrent == theChar) {
|
||||
if(addTerminal)
|
||||
current++;
|
||||
++current;
|
||||
aStart = origin;
|
||||
aEnd = current;
|
||||
goto found;
|
||||
}
|
||||
setcurrent++;
|
||||
++setcurrent;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
found:
|
||||
|
||||
|
@ -1337,12 +1337,12 @@ nsresult nsScanner::ReadUntil(nsAWritableString& aString,
|
|||
if(theChar) {
|
||||
if(aTerminalChar==theChar) {
|
||||
if(addTerminal)
|
||||
current++;
|
||||
++current;
|
||||
AppendUnicodeTo(origin, current, aString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
|
|
@ -546,7 +546,7 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag)
|
|||
// be part of this text token (we wouldn't have come here if it weren't)
|
||||
aScanner.CurrentPosition(origin);
|
||||
start = origin;
|
||||
start++;
|
||||
++start;
|
||||
aScanner.SetPosition(start);
|
||||
|
||||
while((NS_OK==result) && (!done)) {
|
||||
|
@ -571,13 +571,13 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag)
|
|||
// If it standalone, replace the "\r" with a "\n" so that
|
||||
// it will be considered by the layout system
|
||||
aScanner.ReplaceCharacter(end, kLF);
|
||||
end++;
|
||||
++end;
|
||||
}
|
||||
mNewlineCount++;
|
||||
++mNewlineCount;
|
||||
break;
|
||||
case kLF:
|
||||
end++;
|
||||
mNewlineCount++;
|
||||
++end;
|
||||
++mNewlineCount;
|
||||
break;
|
||||
} //switch
|
||||
}
|
||||
|
@ -947,17 +947,17 @@ nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32
|
|||
// If it standalone, replace the "\r" with a "\n" so that
|
||||
// it will be considered by the layout system
|
||||
aScanner.ReplaceCharacter(end, kLF);
|
||||
end++;
|
||||
++end;
|
||||
}
|
||||
mNewlineCount++;
|
||||
++mNewlineCount;
|
||||
break;
|
||||
case kLF:
|
||||
end++;
|
||||
mNewlineCount++;
|
||||
++end;
|
||||
++mNewlineCount;
|
||||
break;
|
||||
case '\'':
|
||||
case '"':
|
||||
end++;
|
||||
++end;
|
||||
if (quote) {
|
||||
if (quote == aChar) {
|
||||
quote = 0;
|
||||
|
@ -968,10 +968,10 @@ nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32
|
|||
break;
|
||||
case kGreaterThan:
|
||||
if (quote) {
|
||||
end++;
|
||||
++end;
|
||||
} else {
|
||||
start = end;
|
||||
start++; // Note that start is wrong after this, we just avoid temp var
|
||||
++start; // Note that start is wrong after this, we just avoid temp var
|
||||
aScanner.SetPosition(start); // Skip the >
|
||||
done=PR_TRUE;
|
||||
}
|
||||
|
@ -1125,12 +1125,12 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
|
|||
|
||||
while((NS_OK==result)) {
|
||||
if (FindCharInReadable(PRUnichar(kGreaterThan), theCurrOffset, endPos)) {
|
||||
theCurrOffset++;
|
||||
++theCurrOffset;
|
||||
nsReadingIterator<PRUnichar> temp = theCurrOffset;
|
||||
temp.advance(-3);
|
||||
aChar=*temp;
|
||||
if(kMinus==aChar) {
|
||||
temp++;
|
||||
++temp;
|
||||
aChar=*temp;
|
||||
if(kMinus==aChar) {
|
||||
theStartOffset.advance(-2); // Include "<!" also..
|
||||
|
|
|
@ -549,7 +549,7 @@ nsresult nsScanner::SkipWhitespace(void) {
|
|||
break;
|
||||
}
|
||||
else {
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -738,7 +738,7 @@ nsresult nsScanner::GetIdentifier(nsString& aString,PRBool allowPunct) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -800,7 +800,7 @@ nsresult nsScanner::ReadIdentifier(nsString& aString,PRBool allowPunct) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -858,7 +858,7 @@ nsresult nsScanner::ReadIdentifier(nsReadingIterator<PRUnichar>& aStart,
|
|||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -915,7 +915,7 @@ nsresult nsScanner::ReadNumber(nsString& aString) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -965,7 +965,7 @@ nsresult nsScanner::ReadNumber(nsReadingIterator<PRUnichar>& aStart,
|
|||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -1024,7 +1024,7 @@ nsresult nsScanner::ReadWhitespace(nsString& aString) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
current ++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -1076,7 +1076,7 @@ nsresult nsScanner::ReadWhitespace(nsReadingIterator<PRUnichar>& aStart,
|
|||
break;
|
||||
}
|
||||
|
||||
current ++;
|
||||
++current;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1125,12 +1125,12 @@ nsresult nsScanner::ReadWhile(nsString& aString,
|
|||
PRInt32 pos=aValidSet.FindChar(theChar);
|
||||
if(kNotFound==pos) {
|
||||
if(addTerminal)
|
||||
current++;
|
||||
++current;
|
||||
AppendUnicodeTo(origin, current, aString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
@ -1180,14 +1180,14 @@ nsresult nsScanner::ReadUntil(nsAWritableString& aString,
|
|||
while (*setcurrent) {
|
||||
if (*setcurrent == theChar) {
|
||||
if(addTerminal)
|
||||
current++;
|
||||
++current;
|
||||
AppendUnicodeTo(origin, current, aString);
|
||||
goto found;
|
||||
}
|
||||
setcurrent++;
|
||||
++setcurrent;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
found:
|
||||
|
||||
|
@ -1238,14 +1238,14 @@ nsresult nsScanner::ReadUntil(nsAWritableString& aString,
|
|||
while (*setcurrent) {
|
||||
if (*setcurrent == theChar) {
|
||||
if(addTerminal)
|
||||
current++;
|
||||
++current;
|
||||
AppendUnicodeTo(origin, current, aString);
|
||||
goto found;
|
||||
}
|
||||
setcurrent++;
|
||||
++setcurrent;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
found:
|
||||
|
||||
|
@ -1286,15 +1286,15 @@ nsresult nsScanner::ReadUntil(nsReadingIterator<PRUnichar>& aStart,
|
|||
while (*setcurrent) {
|
||||
if (*setcurrent == theChar) {
|
||||
if(addTerminal)
|
||||
current++;
|
||||
++current;
|
||||
aStart = origin;
|
||||
aEnd = current;
|
||||
goto found;
|
||||
}
|
||||
setcurrent++;
|
||||
++setcurrent;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
found:
|
||||
|
||||
|
@ -1337,12 +1337,12 @@ nsresult nsScanner::ReadUntil(nsAWritableString& aString,
|
|||
if(theChar) {
|
||||
if(aTerminalChar==theChar) {
|
||||
if(addTerminal)
|
||||
current++;
|
||||
++current;
|
||||
AppendUnicodeTo(origin, current, aString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
current++;
|
||||
++current;
|
||||
}
|
||||
|
||||
SetPosition(current);
|
||||
|
|
|
@ -835,9 +835,9 @@ CountCharInReadable( const nsAString& aStr,
|
|||
|
||||
while (begin != end) {
|
||||
if (*begin == aChar) {
|
||||
count++;
|
||||
++count;
|
||||
}
|
||||
begin++;
|
||||
++begin;
|
||||
}
|
||||
|
||||
return count;
|
||||
|
@ -856,9 +856,9 @@ CountCharInReadable( const nsACString& aStr,
|
|||
|
||||
while (begin != end) {
|
||||
if (*begin == aChar) {
|
||||
count++;
|
||||
++count;
|
||||
}
|
||||
begin++;
|
||||
++begin;
|
||||
}
|
||||
|
||||
return count;
|
||||
|
|
|
@ -835,9 +835,9 @@ CountCharInReadable( const nsAString& aStr,
|
|||
|
||||
while (begin != end) {
|
||||
if (*begin == aChar) {
|
||||
count++;
|
||||
++count;
|
||||
}
|
||||
begin++;
|
||||
++begin;
|
||||
}
|
||||
|
||||
return count;
|
||||
|
@ -856,9 +856,9 @@ CountCharInReadable( const nsACString& aStr,
|
|||
|
||||
while (begin != end) {
|
||||
if (*begin == aChar) {
|
||||
count++;
|
||||
++count;
|
||||
}
|
||||
begin++;
|
||||
++begin;
|
||||
}
|
||||
|
||||
return count;
|
||||
|
|
Загрузка…
Ссылка в новой задаче