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>
This commit is contained in:
hjk
2013-04-15 17:33:52 +02:00
committed by Erik Verbruggen
parent c95d1705aa
commit a1c7c47cc0

View File

@@ -99,13 +99,9 @@ private:
inline void yyinp() inline void yyinp()
{ {
if (++_currentChar == _lastChar) _yychar = *++_currentChar;
_yychar = 0; if (Q_UNLIKELY(_yychar == '\n'))
else { pushLineStartOffset();
_yychar = *_currentChar;
if (_yychar == '\n')
pushLineStartOffset();
}
} }
void pushLineStartOffset(); void pushLineStartOffset();