summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-10-04 11:28:58 +0800
committerMaxime Coste <mawww@kakoune.org>2017-11-01 14:05:14 +0800
commitcf5055f68b8ac049c8ec42e37ee71f9d7841fcd2 (patch)
treeacdfa664a3bca0d27b32bd826136279672f2014c
parente0fac20f6c3f1c101598a5e61a99ee3788c4df07 (diff)
Regex: small code tweak
-rw-r--r--src/regex_impl.hh11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/regex_impl.hh b/src/regex_impl.hh
index 8b98ef21..4d073473 100644
--- a/src/regex_impl.hh
+++ b/src/regex_impl.hh
@@ -270,7 +270,7 @@ struct ThreadedRegexVM
const bool search = (flags & RegexExecFlags::Search);
- const auto start_offset = search ? 0 : CompiledRegex::search_prefix_size;
+ const auto start_offset = search ? 0 : CompiledRegex::search_prefix_size;
Vector<Thread> current_threads{Thread{m_program.bytecode.data() + start_offset, initial_saves}};
Vector<Thread> next_threads;
for (m_pos = Utf8It{m_begin, m_begin, m_end}; m_pos != m_end; ++m_pos)
@@ -282,16 +282,14 @@ struct ThreadedRegexVM
switch (step(thread, current_threads))
{
case StepResult::Matched:
- if (not (flags & RegexExecFlags::Search) or // We are not at end, this is not a full match
+ if (not search or // We are not at end, this is not a full match
(flags & RegexExecFlags::NotInitialNull and m_pos == m_begin))
{
release_saves(thread.saves);
continue;
}
- if (thread.saves)
- m_captures = thread.saves;
-
+ m_captures = thread.saves;
if (flags & RegexExecFlags::AnyMatch)
return true;
@@ -325,8 +323,7 @@ struct ThreadedRegexVM
current_threads.pop_back();
if (step(thread, current_threads) == StepResult::Matched)
{
- if (thread.saves)
- m_captures = thread.saves;
+ m_captures = thread.saves;
return true;
}
}