AK: Don't allow Vector::resize_and_keep_capacity() in the kernel

This function doesn't propagate allocation failures.

Replace the only current user of this function by using `shrink()` with
`keep_capacity = true` instead.
This commit is contained in:
Sönke Holz authored and Sönke Holz committed 2025-11-22 19:51:20 +01:00
1 parent fbb63faa1d
commit 636fb09f80
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -49,7 +49,7 @@ public:
if (is_empty())
return false;
m_stack.resize_and_keep_capacity(m_stack.size() - 1);
m_stack.shrink(m_stack.size() - 1, true);
return true;
}
+1 -1
View File
@@ -788,13 +788,13 @@ public:
{
MUST(try_resize(new_size, keep_capacity));
}
#endif
void resize_and_keep_capacity(size_t new_size)
requires(!contains_reference)
{
MUST(try_resize_and_keep_capacity(new_size));
}
#endif
void shrink_to_fit()
{