diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-04-15 14:52:33 +0100 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2022-04-16 13:27:51 -0400 |
commit | d564cf1e8970275a52a1ef43debe4b1d14b2c063 (patch) | |
tree | dca303a1d92a9cfbe86912edb59fb902b3a74576 /Userland/Libraries/LibCore/ConfigFile.cpp | |
parent | c4134e97944538f34a5881954fb55431ea9da587 (diff) | |
download | serenity-d564cf1e8970275a52a1ef43debe4b1d14b2c063.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibCore/ConfigFile.cpp')
-rw-r--r-- | Userland/Libraries/LibCore/ConfigFile.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Userland/Libraries/LibCore/ConfigFile.cpp b/Userland/Libraries/LibCore/ConfigFile.cpp index bab469e747..b8474ca37f 100644 --- a/Userland/Libraries/LibCore/ConfigFile.cpp +++ b/Userland/Libraries/LibCore/ConfigFile.cpp @@ -88,9 +88,7 @@ ErrorOr<void> ConfigFile::reparse() auto buffer = TRY(ByteBuffer::create_uninitialized(4096)); while (TRY(m_file->can_read_line())) { - auto length = TRY(m_file->read_line(buffer)); - - StringView line { buffer.data(), length }; + auto line = TRY(m_file->read_line(buffer)); size_t i = 0; while (i < line.length() && (line[i] == ' ' || line[i] == '\t' || line[i] == '\n')) |