mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 12:32:20 +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
@@ -316,8 +316,7 @@ static ErrorOr<void> parse_time_zones(StringView time_zone_path, TimeZoneData& t
|
||||
Vector<TimeZoneOffset>* last_parsed_zone = nullptr;
|
||||
|
||||
while (TRY(file->can_read_line())) {
|
||||
auto nread = TRY(file->read_line(buffer));
|
||||
StringView line { buffer.data(), nread };
|
||||
auto line = TRY(file->read_line(buffer));
|
||||
|
||||
if (line.is_empty() || line.trim_whitespace(TrimMode::Left).starts_with('#'))
|
||||
continue;
|
||||
@@ -374,8 +373,7 @@ static ErrorOr<void> parse_time_zone_coordinates(Core::Stream::BufferedFile& fil
|
||||
Array<u8, 1024> buffer {};
|
||||
|
||||
while (TRY(file.can_read_line())) {
|
||||
auto nread = TRY(file.read_line(buffer));
|
||||
StringView line { buffer.data(), nread };
|
||||
auto line = TRY(file.read_line(buffer));
|
||||
|
||||
if (line.is_empty() || line.trim_whitespace(TrimMode::Left).starts_with('#'))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user