summaryrefslogtreecommitdiff
path: root/src/CompatData.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/CompatData.zig')
-rw-r--r--src/CompatData.zig10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/CompatData.zig b/src/CompatData.zig
index cf184a1..ac08048 100644
--- a/src/CompatData.zig
+++ b/src/CompatData.zig
@@ -3,7 +3,6 @@ const builtin = @import("builtin");
3const compress = std.compress; 3const compress = std.compress;
4const mem = std.mem; 4const mem = std.mem;
5 5
6allocator: mem.Allocator,
7nfkd: [][]u21 = undefined, 6nfkd: [][]u21 = undefined,
8 7
9const Self = @This(); 8const Self = @This();
@@ -17,10 +16,9 @@ pub fn init(allocator: mem.Allocator) !Self {
17 16
18 const endian = builtin.cpu.arch.endian(); 17 const endian = builtin.cpu.arch.endian();
19 var self = Self{ 18 var self = Self{
20 .allocator = allocator,
21 .nfkd = try allocator.alloc([]u21, 0x110000), 19 .nfkd = try allocator.alloc([]u21, 0x110000),
22 }; 20 };
23 errdefer self.deinit(); 21 errdefer self.deinit(allocator);
24 22
25 @memset(self.nfkd, &.{}); 23 @memset(self.nfkd, &.{});
26 24
@@ -37,11 +35,11 @@ pub fn init(allocator: mem.Allocator) !Self {
37 return self; 35 return self;
38} 36}
39 37
40pub fn deinit(self: *const Self) void { 38pub fn deinit(self: *const Self, allocator: mem.Allocator) void {
41 for (self.nfkd) |slice| { 39 for (self.nfkd) |slice| {
42 if (slice.len != 0) self.allocator.free(slice); 40 if (slice.len != 0) allocator.free(slice);
43 } 41 }
44 self.allocator.free(self.nfkd); 42 allocator.free(self.nfkd);
45} 43}
46 44
47/// Returns compatibility decomposition for `cp`. 45/// Returns compatibility decomposition for `cp`.