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

Kernel: Use fallible KBuffer API in PerformanceEventBuffer

This commit is contained in:
Andreas Kling 2020-12-18 20:43:39 +01:00
parent fb9a71bd6a
commit d893498e57
2 changed files with 9 additions and 4 deletions

View file

@ -33,7 +33,7 @@
namespace Kernel {
PerformanceEventBuffer::PerformanceEventBuffer()
: m_buffer(KBuffer::create_with_size(4 * MiB))
: m_buffer(KBuffer::try_create_with_size(4 * MiB))
{
}
@ -89,7 +89,7 @@ KResult PerformanceEventBuffer::append(int type, FlatPtr arg1, FlatPtr arg2)
PerformanceEvent& PerformanceEventBuffer::at(size_t index)
{
ASSERT(index < capacity());
auto* events = reinterpret_cast<PerformanceEvent*>(m_buffer.data());
auto* events = reinterpret_cast<PerformanceEvent*>(m_buffer->data());
return events[index];
}