summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-08-17 15:10:55 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-08-17 19:15:49 (GMT)
commit0e6fd509068e1aeeec41d0d1aae7ec2c79b479b6 (patch)
treee4f9be76b0349727099e50b8d1d8f6a7f02a2913
parent33e1639ba798a5726d322139770dc771d03cae72 (diff)
downloadQt-0e6fd509068e1aeeec41d0d1aae7ec2c79b479b6.zip
Qt-0e6fd509068e1aeeec41d0d1aae7ec2c79b479b6.tar.gz
Qt-0e6fd509068e1aeeec41d0d1aae7ec2c79b479b6.tar.bz2
optimize getChar()
work more with raw data instead of qstring functions
-rw-r--r--tools/linguist/lupdate/cpp.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index 581662a..70a2470 100644
--- a/tools/linguist/lupdate/cpp.cpp
+++ b/tools/linguist/lupdate/cpp.cpp
@@ -312,26 +312,28 @@ void CppParser::setInput(QTextStream &ts, const QString &fileName)
uint CppParser::getChar()
{
+ int len = yyInStr.size();
+ const ushort *uc = (const ushort *)yyInStr.unicode();
forever {
- if (yyInPos >= yyInStr.size())
+ if (yyInPos >= len)
return EOF;
- uint c = yyInStr[yyInPos++].unicode();
- if (c == '\\' && yyInPos < yyInStr.size()) {
- if (yyInStr[yyInPos].unicode() == '\n') {
+ uint c = uc[yyInPos++];
+ if (c == '\\' && yyInPos < len) {
+ if (uc[yyInPos] == '\n') {
++yyCurLineNo;
++yyInPos;
continue;
}
- if (yyInStr[yyInPos].unicode() == '\r') {
+ if (uc[yyInPos] == '\r') {
++yyCurLineNo;
++yyInPos;
- if (yyInPos < yyInStr.size() && yyInStr[yyInPos].unicode() == '\n')
+ if (yyInPos < len && uc[yyInPos] == '\n')
++yyInPos;
continue;
}
}
if (c == '\r') {
- if (yyInPos < yyInStr.size() && yyInStr[yyInPos].unicode() == '\n')
+ if (yyInPos < len && uc[yyInPos] == '\n')
++yyInPos;
c = '\n';
++yyCurLineNo;