Remove unnecessary utf8 decoding when looking for EOL in regex

This commit is contained in:
Maxime Coste 2022-08-10 21:16:02 +01:00
parent c8c8051bd0
commit 21047db4a0

View File

@ -587,14 +587,14 @@ private:
{
if (pos == config.subject_begin)
return not (config.flags & RegexExecFlags::NotBeginOfLine);
return utf8::codepoint(utf8::previous(pos, config.subject_begin), config.subject_end) == '\n';
return *(pos-1) == '\n';
}
static bool is_line_end(const Iterator& pos, const ExecConfig& config)
{
if (pos == config.subject_end)
return not (config.flags & RegexExecFlags::NotEndOfLine);
return utf8::codepoint(pos, config.subject_end) == '\n';
return *pos == '\n';
}
static bool is_word_boundary(const Iterator& pos, const ExecConfig& config)