1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibCore: Don't rely on \n detection to populate the buffer

We don't need to call `can_read_line()` as the buffer will be populated
by `find_and_populate_until_any_of()`. The change is also beneficial as
the buffer will be populated until a candidate is found and not
necessarily a new line.
This commit is contained in:
Lucas CHOLLET 2022-12-17 01:42:02 +01:00 committed by Andrew Kaster
parent 8252436c18
commit 4402720a15

View file

@ -690,10 +690,6 @@ public:
if (buffer.is_empty())
return Error::from_errno(ENOBUFS);
// We fill the buffer through can_read_line.
if (!TRY(can_read_line()))
return Bytes {};
auto const candidate = TRY(find_and_populate_until_any_of(candidates, buffer.size()));
if (stream().is_eof()) {