diff --git a/src/regex_impl.hh b/src/regex_impl.hh index b30b9735..0e992aed 100644 --- a/src/regex_impl.hh +++ b/src/regex_impl.hh @@ -76,21 +76,17 @@ struct ThreadedRegexVM Saves* clone_saves(Saves* saves) { - Saves* res = nullptr; if (not m_free_saves.empty()) { - res = m_free_saves.back(); + Saves* res = m_free_saves.back(); m_free_saves.pop_back(); - } - else - { - m_saves.push_back(std::make_unique()); - res = m_saves.back().get(); + res->refcount = 1; + res->pos = saves->pos; + return res; } - res->refcount = 1; - res->pos = saves->pos; - return res; + m_saves.push_back(std::make_unique(Saves{1, saves->pos})); + return m_saves.back().get(); } struct Thread