diff options
Diffstat (limited to 'src/GraphemeData.zig')
| -rw-r--r-- | src/GraphemeData.zig | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/GraphemeData.zig b/src/GraphemeData.zig index de98bde..6d3174d 100644 --- a/src/GraphemeData.zig +++ b/src/GraphemeData.zig | |||
| @@ -30,7 +30,6 @@ pub const Gbp = enum { | |||
| 30 | ZWJ, | 30 | ZWJ, |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | allocator: mem.Allocator, | ||
| 34 | s1: []u16 = undefined, | 33 | s1: []u16 = undefined, |
| 35 | s2: []u16 = undefined, | 34 | s2: []u16 = undefined, |
| 36 | s3: []u8 = undefined, | 35 | s3: []u8 = undefined, |
| @@ -46,7 +45,7 @@ pub fn init(allocator: mem.Allocator) mem.Allocator.Error!Self { | |||
| 46 | 45 | ||
| 47 | const endian = builtin.cpu.arch.endian(); | 46 | const endian = builtin.cpu.arch.endian(); |
| 48 | 47 | ||
| 49 | var self = Self{ .allocator = allocator }; | 48 | var self = Self{}; |
| 50 | 49 | ||
| 51 | const s1_len: u16 = reader.readInt(u16, endian) catch unreachable; | 50 | const s1_len: u16 = reader.readInt(u16, endian) catch unreachable; |
| 52 | self.s1 = try allocator.alloc(u16, s1_len); | 51 | self.s1 = try allocator.alloc(u16, s1_len); |
| @@ -66,10 +65,10 @@ pub fn init(allocator: mem.Allocator) mem.Allocator.Error!Self { | |||
| 66 | return self; | 65 | return self; |
| 67 | } | 66 | } |
| 68 | 67 | ||
| 69 | pub fn deinit(self: *const Self) void { | 68 | pub fn deinit(self: *const Self, allocator: mem.Allocator) void { |
| 70 | self.allocator.free(self.s1); | 69 | allocator.free(self.s1); |
| 71 | self.allocator.free(self.s2); | 70 | allocator.free(self.s2); |
| 72 | self.allocator.free(self.s3); | 71 | allocator.free(self.s3); |
| 73 | } | 72 | } |
| 74 | 73 | ||
| 75 | /// Lookup the grapheme break property for a code point. | 74 | /// Lookup the grapheme break property for a code point. |