From 2f93b2eba5c98754f4f75775fe9c1da302561843 Mon Sep 17 00:00:00 2001 From: Pierre Curto Date: Tue, 3 Oct 2023 15:03:31 +0200 Subject: [PATCH] make DString use its allocator if unspecified in DString.copy Signed-off-by: Pierre Curto --- lib/std/core/dstring.c3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/core/dstring.c3 b/lib/std/core/dstring.c3 index c9bd51574..267c9d8de 100644 --- a/lib/std/core/dstring.c3 +++ b/lib/std/core/dstring.c3 @@ -175,8 +175,8 @@ fn DString DString.copy(self, Allocator* using = null) if (using) return new_with_capacity(0, using); return (DString)null; } - if (!using) using = mem::heap(); StringData* data = self.data(); + if (!using) using = data.allocator; DString new_string = new_with_capacity(data.capacity, using); mem::copy((char*)new_string.data(), (char*)data, StringData.sizeof + data.len); return new_string;