summaryrefslogtreecommitdiff
path: root/src/GraphemeData.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/GraphemeData.zig')
-rw-r--r--src/GraphemeData.zig11
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
33allocator: mem.Allocator,
34s1: []u16 = undefined, 33s1: []u16 = undefined,
35s2: []u16 = undefined, 34s2: []u16 = undefined,
36s3: []u8 = undefined, 35s3: []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
69pub fn deinit(self: *const Self) void { 68pub 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.