1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:47:35 +00:00

AK: Use MUST + try_empend so AK::Trie continues to compile in the kernel

This commit is contained in:
Brian Gianforcaro 2022-01-03 03:13:28 -08:00 committed by Andreas Kling
parent 7d27798c8d
commit 48206be121

View file

@ -43,7 +43,8 @@ class Trie {
explicit ConstIterator(const Trie& node) explicit ConstIterator(const Trie& node)
{ {
m_current_node = &node; m_current_node = &node;
m_state.empend(false, node.m_children.begin(), node.m_children.end()); // FIXME: Figure out how to OOM harden this iterator.
MUST(m_state.try_empend(false, node.m_children.begin(), node.m_children.end()));
} }
private: private:
@ -58,7 +59,9 @@ class Trie {
return pop_and_get_next(); return pop_and_get_next();
m_current_node = &*(*current_state.it).value; m_current_node = &*(*current_state.it).value;
m_state.empend(false, m_current_node->m_children.begin(), m_current_node->m_children.end());
// FIXME: Figure out how to OOM harden this iterator.
MUST(m_state.try_empend(false, m_current_node->m_children.begin(), m_current_node->m_children.end()));
} }
void pop_and_get_next() void pop_and_get_next()
{ {