Regex: small code style tweak

This commit is contained in:
Maxime Coste 2017-10-03 01:16:30 +08:00
parent 51ad8b4c85
commit 11b9c996ea

View File

@ -242,6 +242,8 @@ struct ThreadedRegexVM
if (m_threads.empty()) if (m_threads.empty())
return found_match; return found_match;
} }
if (found_match)
return true;
// Step remaining threads to see if they match without consuming anything else // Step remaining threads to see if they match without consuming anything else
for (int i = 0; i < m_threads.size(); ++i) for (int i = 0; i < m_threads.size(); ++i)
@ -249,14 +251,10 @@ struct ThreadedRegexVM
if (step(i) == StepResult::Matched) if (step(i) == StepResult::Matched)
{ {
m_captures = std::move(m_threads[i].saves); m_captures = std::move(m_threads[i].saves);
if (flags & RegexExecFlags::AnyMatch)
return true; return true;
found_match = true;
m_threads.resize(i); // remove this and lower priority threads
} }
} }
return found_match; return false;
} }
void add_thread(int index, const char* inst, Vector<Iterator> saves) void add_thread(int index, const char* inst, Vector<Iterator> saves)