diff --git a/lib/std/core/dstring.c3 b/lib/std/core/dstring.c3 index e9bb4eb0f..31ccbc4ad 100644 --- a/lib/std/core/dstring.c3 +++ b/lib/std/core/dstring.c3 @@ -371,8 +371,10 @@ fn void DString.reserve(&self, 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; + while (new_capacity < len) new_capacity *= 2; + data.capacity = new_capacity; *self = (DString)realloc(data, StringData.sizeof + new_capacity, .using = data.allocator); } diff --git a/src/version.h b/src/version.h index 269ea355b..909a29c8f 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "0.4.587" \ No newline at end of file +#define COMPILER_VERSION "0.4.588" \ No newline at end of file