summaryrefslogtreecommitdiff
path: root/src/FoldData.zig
diff options
context:
space:
mode:
authorGravatar lch3612025-03-25 00:29:52 +0300
committerGravatar Sam Atman2025-04-29 12:30:55 -0400
commit2f44fdebca57d9eabb682e05d04189d0600b8664 (patch)
tree617e7d4be89c1a965848dbc7f9b5f2a273faa9d7 /src/FoldData.zig
parentBump copyright year, isolate iterator tests (diff)
downloadzg-2f44fdebca57d9eabb682e05d04189d0600b8664.tar.gz
zg-2f44fdebca57d9eabb682e05d04189d0600b8664.tar.xz
zg-2f44fdebca57d9eabb682e05d04189d0600b8664.zip
All the std.mem.Allocators that were stored just for init and deinit
methods were removed, mem.Allocators were added to deinit as arguments.
Diffstat (limited to 'src/FoldData.zig')
-rw-r--r--src/FoldData.zig13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/FoldData.zig b/src/FoldData.zig
index a3d47af..e44e714 100644
--- a/src/FoldData.zig
+++ b/src/FoldData.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,
7cutoff: u21 = undefined, 6cutoff: u21 = undefined,
8cwcf_exceptions_min: u21 = undefined, 7cwcf_exceptions_min: u21 = undefined,
9cwcf_exceptions_max: u21 = undefined, 8cwcf_exceptions_max: u21 = undefined,
@@ -24,7 +23,7 @@ pub fn init(allocator: mem.Allocator) !Self {
24 23
25 const endian = builtin.cpu.arch.endian(); 24 const endian = builtin.cpu.arch.endian();
26 25
27 var self = Self{ .allocator = allocator }; 26 var self = Self{};
28 self.cutoff = @intCast(try reader.readInt(u24, endian)); 27 self.cutoff = @intCast(try reader.readInt(u24, endian));
29 self.multiple_start = @intCast(try reader.readInt(u24, endian)); 28 self.multiple_start = @intCast(try reader.readInt(u24, endian));
30 29
@@ -53,11 +52,11 @@ pub fn init(allocator: mem.Allocator) !Self {
53 return self; 52 return self;
54} 53}
55 54
56pub fn deinit(self: *const Self) void { 55pub fn deinit(self: *const Self, allocator: mem.Allocator) void {
57 self.allocator.free(self.stage1); 56 allocator.free(self.stage1);
58 self.allocator.free(self.stage2); 57 allocator.free(self.stage2);
59 self.allocator.free(self.stage3); 58 allocator.free(self.stage3);
60 self.allocator.free(self.cwcf_exceptions); 59 allocator.free(self.cwcf_exceptions);
61} 60}
62 61
63/// Returns the case fold for `cp`. 62/// Returns the case fold for `cp`.