From 2150e1b3a5d67f5a5740b6a90c3f6235233b1249 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Fri, 13 Jan 2023 13:41:48 +0100 Subject: Shell: Use `AllocatingMemoryStream` to search for the IFS --- Userland/Shell/AST.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'Userland/Shell/AST.cpp') diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp index 35e0cc810f..6f7704fdff 100644 --- a/Userland/Shell/AST.cpp +++ b/Userland/Shell/AST.cpp @@ -7,13 +7,13 @@ #include "AST.h" #include "Shell.h" #include -#include #include #include #include #include #include #include +#include #include #include #include @@ -1641,7 +1641,7 @@ void Execute::for_each_entry(RefPtr shell, Function shell, Functionlocal_variable_or("IFS"sv, "\n"sv); - if (auto offset = stream.offset_of(ifs.bytes()); offset.has_value()) { + if (auto offset = stream.offset_of(ifs.bytes()).release_value_but_fixme_should_propagate_errors(); offset.has_value()) { auto line_end = offset.value(); if (line_end == 0) { - auto rc = stream.discard_or_error(ifs.length()); - VERIFY(rc); + stream.discard(ifs.length()).release_value_but_fixme_should_propagate_errors(); if (shell->options.inline_exec_keep_empty_segments) if (callback(make_ref_counted("")) == IterationDecision::Break) { @@ -1671,8 +1670,7 @@ void Execute::for_each_entry(RefPtr shell, Function(str)) == IterationDecision::Break) { @@ -1723,7 +1721,7 @@ void Execute::for_each_entry(RefPtr shell, Function shell, Function shell, Functionraise_error(Shell::ShellError::OutOfMemory, {}, position()); return; } auto entry = entry_result.release_value(); - auto rc = stream.read_or_error(entry); - VERIFY(rc); + stream.read_entire_buffer(entry).release_value_but_fixme_should_propagate_errors(); callback(make_ref_counted(DeprecatedString::copy(entry))); } } -- cgit v1.2.3