Skip to content

Commit

Permalink
make DString use its allocator if unspecified in DString.copy
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Curto <[email protected]>
  • Loading branch information
pierrec committed Oct 3, 2023
1 parent 4cc30c0 commit 2f93b2e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/std/core/dstring.c3
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2f93b2e

Please sign in to comment.