Fix issue in List with sanitizers.

This commit is contained in:
Christoffer Lerno
2025-02-11 00:13:04 +01:00
parent 9e54014848
commit d3ad533dd6
2 changed files with 5 additions and 3 deletions

View File

@@ -234,11 +234,11 @@ fn void List.push_front(&self, Type type) @inline
fn void List.insert_at(&self, usz index, Type type)
{
self.reserve(1);
for (usz i = self.size; i > index; i--)
self.set_size(self.size + 1);
for (isz i = self.size - 1; i > index; i--)
{
self.entries[i] = self.entries[i - 1];
}
self.set_size(self.size + 1);
self.entries[index] = type;
}
@@ -342,7 +342,8 @@ fn usz List.retain_if(&self, ElementPredicate selection)
fn usz List.remove_using_test(&self, ElementTest filter, any context)
{
usz old_size = self.size;
defer {
defer
{
if (old_size != self.size) self._update_size_change(old_size, self.size);
}
return list_common::list_remove_using_test(self, filter, false, context);

View File

@@ -62,6 +62,7 @@
- `set_env` would leak memory.
- Fix issue where aligned bitstructs did not store/load with the given alignment.
- Fix issue in GrowableBitSet with sanitizers.
- Fix issue in List with sanitizers.
### Stdlib changes
- Added '%h' and '%H' for printing out binary data in hexadecimal using the formatter.