1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 14:27:34 +00: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:
Sam Atkins 2022-04-15 14:52:33 +01:00 committed by Tim Flynn
parent c4134e9794
commit d564cf1e89
9 changed files with 40 additions and 54 deletions

View file

@ -30,8 +30,7 @@ ErrorOr<void> DomainListModel::load()
auto content_filter_list = TRY(Core::Stream::BufferedFile::create(move(file)));
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
while (TRY(content_filter_list->can_read_line())) {
auto length = TRY(content_filter_list->read_line(buffer));
StringView line { buffer.data(), length };
auto line = TRY(content_filter_list->read_line(buffer));
dbgln("Content filter for {}", line);
if (!line.is_empty())
m_domain_list.append(line);