diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-08-17 17:10:55 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-08-17 21:15:49 +0200 |
commit | 0e6fd509068e1aeeec41d0d1aae7ec2c79b479b6 (patch) | |
tree | e4f9be76b0349727099e50b8d1d8f6a7f02a2913 /tools/linguist/lupdate/cpp.cpp | |
parent | 33e1639ba798a5726d322139770dc771d03cae72 (diff) | |
download | qt4-tools-0e6fd509068e1aeeec41d0d1aae7ec2c79b479b6.tar.gz |
optimize getChar()
work more with raw data instead of qstring functions
Diffstat (limited to 'tools/linguist/lupdate/cpp.cpp')
-rw-r--r-- | tools/linguist/lupdate/cpp.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 581662ae9f..70a2470536 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; |