forked from Bananymous/banan-os
BAN: Fix unstable hash map rebucket
This commit is contained in:
parent
3963afe343
commit
bacc0db778
|
@ -223,10 +223,6 @@ namespace BAN
|
||||||
if (new_buckets.resize(new_bucket_count).is_error())
|
if (new_buckets.resize(new_bucket_count).is_error())
|
||||||
return Error::from_errno(ENOMEM);
|
return Error::from_errno(ENOMEM);
|
||||||
|
|
||||||
if constexpr(STABLE)
|
|
||||||
{
|
|
||||||
// NOTE: We have to copy the old entries to the new entries and not move
|
|
||||||
// since we might run out of memory half way through.
|
|
||||||
for (auto& bucket : m_buckets)
|
for (auto& bucket : m_buckets)
|
||||||
{
|
{
|
||||||
for (Entry& entry : bucket)
|
for (Entry& entry : bucket)
|
||||||
|
@ -238,7 +234,6 @@ namespace BAN
|
||||||
TRY(new_buckets[bucket_index].push_back(BAN::move(entry)));
|
TRY(new_buckets[bucket_index].push_back(BAN::move(entry)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_buckets = move(new_buckets);
|
m_buckets = move(new_buckets);
|
||||||
return {};
|
return {};
|
||||||
|
|
Loading…
Reference in New Issue