AK+Kernel+Userland: Don't allow Vector::append() in the kernel

This makes it not as easy to forgot to handle OOMs in the kernel.

This commit replaces most usages of this function with
`try_append(...).release_value_but_fixme_should_propagate_errors()`.
But in some cases, using the `TRY` macro or `unchecked_append()` is
already possible.

In places where allocations should not fail or an OOM would be fatal
anyways, `MUST(try_append(...))` should be used explicitly.
This commit is contained in:
Sönke Holz
2025-11-15 21:31:53 +01:00
committed by Sönke Holz
parent 84e02b71fa
commit e8d9734a9c
41 changed files with 102 additions and 104 deletions

View File

@@ -273,7 +273,7 @@ void VirtualFileSystem::sync_filesystems()
Vector<NonnullRefPtr<FileSystem>, 32> file_systems;
s_details->file_systems_list.with([&](auto const& list) {
for (auto& fs : list)
file_systems.append(fs);
file_systems.try_append(fs).release_value_but_fixme_should_propagate_errors();
});
for (auto& fs : file_systems) {