mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
use the compiler's str.zig from platforms
This commit is contained in:
parent
ea05561d85
commit
a79a9ea253
13 changed files with 39 additions and 15164 deletions
|
@ -89,7 +89,10 @@ pub const RocStr = extern struct {
|
|||
pub fn deinit(self: RocStr, allocator: *Allocator) void {
|
||||
if (!self.isSmallStr() and !self.isEmpty()) {
|
||||
const str_bytes_ptr: [*]u8 = self.str_bytes orelse unreachable;
|
||||
const str_bytes: []u8 = str_bytes_ptr[0..self.str_len];
|
||||
|
||||
// include the refcount bytes
|
||||
const refcount_bytes = @sizeOf(usize);
|
||||
const str_bytes: []u8 = (str_bytes_ptr - refcount_bytes)[0 .. self.str_len + refcount_bytes];
|
||||
allocator.free(str_bytes);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue