mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:07:34 +00:00
LibSQL: Remove and update VERIFY
s
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:
parent
036eb82aca
commit
8992ff5aeb
5 changed files with 2 additions and 15 deletions
|
@ -28,7 +28,6 @@ public:
|
|||
|
||||
void get_block(u32 pointer)
|
||||
{
|
||||
VERIFY(m_heap.ptr() != nullptr);
|
||||
auto buffer_or_error = m_heap->read_block(pointer);
|
||||
if (buffer_or_error.is_error())
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -110,7 +109,7 @@ public:
|
|||
template<typename T>
|
||||
bool serialize_and_write(T const& t)
|
||||
{
|
||||
VERIFY(m_heap.ptr() != nullptr);
|
||||
VERIFY(!m_heap.is_null());
|
||||
reset();
|
||||
serialize<T>(t);
|
||||
m_heap->add_to_wal(t.pointer(), m_buffer);
|
||||
|
@ -120,20 +119,17 @@ public:
|
|||
[[nodiscard]] size_t offset() const { return m_current_offset; }
|
||||
u32 new_record_pointer()
|
||||
{
|
||||
VERIFY(m_heap.ptr() != nullptr);
|
||||
return m_heap->new_record_pointer();
|
||||
}
|
||||
|
||||
bool has_block(u32 pointer) const
|
||||
{
|
||||
VERIFY(m_heap.ptr() != nullptr);
|
||||
return pointer < m_heap->size();
|
||||
}
|
||||
|
||||
Heap& heap()
|
||||
{
|
||||
VERIFY(m_heap.ptr() != nullptr);
|
||||
return *(m_heap.ptr());
|
||||
return *m_heap;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue