From 21047db4a0775e61375065d429c583783815119e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 10 Aug 2022 21:16:02 +0100 Subject: [PATCH] Remove unnecessary utf8 decoding when looking for EOL in regex --- src/regex_impl.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/regex_impl.hh b/src/regex_impl.hh index b0ceeecf..a6b3a15e 100644 --- a/src/regex_impl.hh +++ b/src/regex_impl.hh @@ -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)