From 11b9c996ea2791c16fd7ff205e10499bc32afff4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 3 Oct 2017 01:16:30 +0800 Subject: [PATCH] Regex: small code style tweak --- src/regex_impl.hh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/regex_impl.hh b/src/regex_impl.hh index 12f71ac8..8b7fa9b8 100644 --- a/src/regex_impl.hh +++ b/src/regex_impl.hh @@ -242,6 +242,8 @@ struct ThreadedRegexVM if (m_threads.empty()) return found_match; } + if (found_match) + return true; // Step remaining threads to see if they match without consuming anything else for (int i = 0; i < m_threads.size(); ++i) @@ -249,14 +251,10 @@ struct ThreadedRegexVM if (step(i) == StepResult::Matched) { m_captures = std::move(m_threads[i].saves); - if (flags & RegexExecFlags::AnyMatch) - return true; - - found_match = true; - m_threads.resize(i); // remove this and lower priority threads + return true; } } - return found_match; + return false; } void add_thread(int index, const char* inst, Vector saves)