1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

LibSQL: Remove and update VERIFYs

We are performing a lot of checks on pointers that are performed again
immediately afterwards because of a dereference. This removes the
redundant `VERIFY`s and simplifies a couple others.
This commit is contained in:
Jelle Raaijmakers 2023-04-19 18:58:56 +02:00 committed by Tim Flynn
parent 036eb82aca
commit 8992ff5aeb
5 changed files with 2 additions and 15 deletions

View file

@ -65,7 +65,6 @@ bool BTree::insert(Key const& key)
{
if (!m_root)
initialize_root();
VERIFY(m_root);
return m_root->insert(key);
}
@ -73,7 +72,6 @@ bool BTree::update_key_pointer(Key const& key)
{
if (!m_root)
initialize_root();
VERIFY(m_root);
return m_root->update_key_pointer(key);
}
@ -81,7 +79,6 @@ Optional<u32> BTree::get(Key& key)
{
if (!m_root)
initialize_root();
VERIFY(m_root);
return m_root->get(key);
}
@ -89,7 +86,6 @@ BTreeIterator BTree::find(Key const& key)
{
if (!m_root)
initialize_root();
VERIFY(m_root);
for (auto node = m_root->node_for(key); node; node = node->up()) {
for (auto ix = 0u; ix < node->size(); ix++) {
auto match = (*node)[ix].match(key);