From 0e6fd509068e1aeeec41d0d1aae7ec2c79b479b6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 17 Aug 2009 17:10:55 +0200 Subject: optimize getChar() work more with raw data instead of qstring functions --- tools/linguist/lupdate/cpp.cpp | 16 +++++++++------- 1 file 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; -- cgit v0.12