Regex: small refactor of ThreadedRegexVM::clone_saves
This commit is contained in:
parent
9fbafba4cb
commit
119bc38254
|
@ -76,23 +76,19 @@ struct ThreadedRegexVM
|
||||||
|
|
||||||
Saves* clone_saves(Saves* saves)
|
Saves* clone_saves(Saves* saves)
|
||||||
{
|
{
|
||||||
Saves* res = nullptr;
|
|
||||||
if (not m_free_saves.empty())
|
if (not m_free_saves.empty())
|
||||||
{
|
{
|
||||||
res = m_free_saves.back();
|
Saves* res = m_free_saves.back();
|
||||||
m_free_saves.pop_back();
|
m_free_saves.pop_back();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_saves.push_back(std::make_unique<Saves>());
|
|
||||||
res = m_saves.back().get();
|
|
||||||
}
|
|
||||||
|
|
||||||
res->refcount = 1;
|
res->refcount = 1;
|
||||||
res->pos = saves->pos;
|
res->pos = saves->pos;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_saves.push_back(std::make_unique<Saves>(Saves{1, saves->pos}));
|
||||||
|
return m_saves.back().get();
|
||||||
|
}
|
||||||
|
|
||||||
struct Thread
|
struct Thread
|
||||||
{
|
{
|
||||||
const char* inst;
|
const char* inst;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user