mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
AK: Make Vector::try_* functions return ErrorOr<void>
Instead of signalling allocation failure with a bool return value (false), we now use ErrorOr<void> and return ENOMEM as appropriate. This allows us to use TRY() and MUST() with Vector. :^)
This commit is contained in:
parent
cd49f30bea
commit
88b6428c25
16 changed files with 98 additions and 152 deletions
|
@ -24,8 +24,7 @@ ErrorOr<FlatPtr> Process::sys$writev(int fd, Userspace<const struct iovec*> iov,
|
|||
|
||||
u64 total_length = 0;
|
||||
Vector<iovec, 32> vecs;
|
||||
if (!vecs.try_resize(iov_count))
|
||||
return ENOMEM;
|
||||
TRY(vecs.try_resize(iov_count));
|
||||
TRY(copy_n_from_user(vecs.data(), iov, iov_count));
|
||||
for (auto& vec : vecs) {
|
||||
total_length += vec.iov_len;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue