summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2013-04-15 17:33:52 +0200
committerErik Verbruggen <erik.verbruggen@digia.com>2013-04-16 11:26:30 +0200
commita1c7c47cc0b7072ba6ee18798ea8ab62d23c885d (patch)
tree4619f53639e9cbf263b1b49b96ed214429f672dd /src
parentc95d1705aa6ed229173ebd2905f90bb96e571690 (diff)
downloadqt-creator-a1c7c47cc0b7072ba6ee18798ea8ab62d23c885d.tar.gz
C++: Simplify Lexer::yyinp()
... by assuming we operate on NUL-terminated data, which is (in theory) guaranteed by (non-raw) QByteArray which we have. Change-Id: I855d01ea0dee5328ec737fbabee1086d7a28aa5a Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/libs/3rdparty/cplusplus/Lexer.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/libs/3rdparty/cplusplus/Lexer.h b/src/libs/3rdparty/cplusplus/Lexer.h
index 0d527f1d82..e2e39ed480 100644
--- a/src/libs/3rdparty/cplusplus/Lexer.h
+++ b/src/libs/3rdparty/cplusplus/Lexer.h
@@ -99,13 +99,9 @@ private:
inline void yyinp()
{
- if (++_currentChar == _lastChar)
- _yychar = 0;
- else {
- _yychar = *_currentChar;
- if (_yychar == '\n')
- pushLineStartOffset();
- }
+ _yychar = *++_currentChar;
+ if (Q_UNLIKELY(_yychar == '\n'))
+ pushLineStartOffset();
}
void pushLineStartOffset();