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

LibTLS: Remove useless ByteBuffer allocation in TLSv12::read_line()

This commit is contained in:
Ali Mohammad Pur 2021-10-10 01:40:53 +03:30 committed by Andreas Kling
parent c8d825e1b3
commit e8891e6d56

View file

@ -51,14 +51,6 @@ String TLSv12::read_line(size_t max_size)
if (offset > max_size)
return {};
auto buffer_result = ByteBuffer::copy(start, offset);
if (!buffer_result.has_value()) {
dbgln("TLS: Failed to read line, not enough memory");
dbgln("max_size < offset: {} < {} (size = {})", max_size, offset, m_context.application_buffer.size());
dbgln("-> {:32hex-dump}", ReadonlyBytes { start, offset });
return {};
}
String line { bit_cast<char const*>(start), offset, Chomp };
m_context.application_buffer = m_context.application_buffer.slice(offset + 1, m_context.application_buffer.size() - offset - 1);