1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

Shell: Use NonnullRefPtr to simplify some things in the parser/AST

This commit is contained in:
Andreas Kling 2020-08-04 18:16:37 +02:00
parent 7a3ab6c517
commit 3cb8ae873c
4 changed files with 12 additions and 12 deletions

View file

@ -2041,24 +2041,24 @@ Vector<String> TildeValue::resolve_as_list(RefPtr<Shell> shell)
return { shell->expand_tilde(builder.to_string()) };
}
Result<RefPtr<Rewiring>, String> CloseRedirection::apply() const
Result<NonnullRefPtr<Rewiring>, String> CloseRedirection::apply() const
{
return static_cast<RefPtr<Rewiring>>((adopt(*new Rewiring(fd, fd, Rewiring::Close::ImmediatelyCloseDestination))));
return adopt(*new Rewiring(fd, fd, Rewiring::Close::ImmediatelyCloseDestination));
}
CloseRedirection::~CloseRedirection()
{
}
Result<RefPtr<Rewiring>, String> PathRedirection::apply() const
Result<NonnullRefPtr<Rewiring>, String> PathRedirection::apply() const
{
auto check_fd_and_return = [my_fd = this->fd](int fd, const String& path) -> Result<RefPtr<Rewiring>, String> {
auto check_fd_and_return = [my_fd = this->fd](int fd, const String& path) -> Result<NonnullRefPtr<Rewiring>, String> {
if (fd < 0) {
String error = strerror(errno);
dbg() << "open() failed for '" << path << "' with " << error;
return error;
}
return static_cast<RefPtr<Rewiring>>((adopt(*new Rewiring(my_fd, fd, Rewiring::Close::Destination))));
return adopt(*new Rewiring(my_fd, fd, Rewiring::Close::Destination));
};
switch (direction) {
case AST::PathRedirection::WriteAppend: