mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibCore+Everywhere: Make Core::Stream read_line() return StringView
Similar reasoning to making Core::Stream::read() return Bytes, except that every user of read_line() creates a StringView from the result, so let's just return one right away.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 11:46:28 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/d564cf1e89 Pull-request: https://github.com/SerenityOS/serenity/pull/13694 Reviewed-by: https://github.com/trflynn89
@@ -63,8 +63,8 @@ ErrorOr<ByteBuffer> WebSocketImpl::read(int max_size)
|
||||
ErrorOr<String> WebSocketImpl::read_line(size_t size)
|
||||
{
|
||||
auto buffer = TRY(ByteBuffer::create_uninitialized(size));
|
||||
auto nread = TRY(m_socket->read_line(buffer));
|
||||
return String::copy(buffer.span().slice(0, nread));
|
||||
auto line = TRY(m_socket->read_line(buffer));
|
||||
return line.to_string();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user