Fix of string function.

This commit is contained in:
Christoffer Lerno
2022-12-06 17:48:30 +01:00
parent 287de8f499
commit 5721fcc224

View File

@@ -297,7 +297,7 @@ private fn void String.reserve(String* str, usz addition)
}
usz len = data.len + addition;
if (data.capacity >= len) return;
usz new_capacity = data.capacity * 2;
usz new_capacity = data.capacity *= 2;
if (new_capacity < MIN_CAPACITY) new_capacity = MIN_CAPACITY;
*str = (String)data.allocator.realloc(data, StringData.sizeof + new_capacity)!!;
}