mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-10 05:02:54 +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:
parent
c4134e9794
commit
d564cf1e89
Notes:
sideshowbarker
2024-07-17 11:46:28 +09:00
Author: https://github.com/AtkinsSJ
Commit: d564cf1e89
Pull-request: https://github.com/SerenityOS/serenity/pull/13694
Reviewed-by: https://github.com/trflynn89
9 changed files with 40 additions and 54 deletions
|
@ -197,8 +197,7 @@ static ErrorOr<void> parse_special_casing(Core::Stream::BufferedFile& file, Unic
|
|||
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.starts_with('#'))
|
||||
continue;
|
||||
|
@ -264,8 +263,7 @@ static ErrorOr<void> parse_prop_list(Core::Stream::BufferedFile& file, PropList&
|
|||
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.starts_with('#'))
|
||||
continue;
|
||||
|
@ -311,8 +309,7 @@ static ErrorOr<void> parse_alias_list(Core::Stream::BufferedFile& file, PropList
|
|||
};
|
||||
|
||||
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.starts_with('#')) {
|
||||
if (line.ends_with("Properties"sv))
|
||||
|
@ -345,8 +342,7 @@ static ErrorOr<void> parse_name_aliases(Core::Stream::BufferedFile& file, Unicod
|
|||
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.starts_with('#'))
|
||||
continue;
|
||||
|
@ -387,8 +383,7 @@ static ErrorOr<void> parse_value_alias_list(Core::Stream::BufferedFile& file, St
|
|||
};
|
||||
|
||||
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.starts_with('#'))
|
||||
continue;
|
||||
|
@ -421,8 +416,7 @@ static ErrorOr<void> parse_normalization_props(Core::Stream::BufferedFile& file,
|
|||
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.starts_with('#'))
|
||||
continue;
|
||||
|
@ -518,8 +512,7 @@ static ErrorOr<void> parse_block_display_names(Core::Stream::BufferedFile& file,
|
|||
{
|
||||
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.starts_with('#'))
|
||||
continue;
|
||||
|
||||
|
@ -547,8 +540,7 @@ static ErrorOr<void> parse_unicode_data(Core::Stream::BufferedFile& file, Unicod
|
|||
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())
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue