diff options
| author | 2025-03-25 00:29:52 +0300 | |
|---|---|---|
| committer | 2025-04-29 12:30:55 -0400 | |
| commit | 2f44fdebca57d9eabb682e05d04189d0600b8664 (patch) | |
| tree | 617e7d4be89c1a965848dbc7f9b5f2a273faa9d7 /src/FoldData.zig | |
| parent | Bump copyright year, isolate iterator tests (diff) | |
| download | zg-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.zig | 13 |
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"); | |||
| 3 | const compress = std.compress; | 3 | const compress = std.compress; |
| 4 | const mem = std.mem; | 4 | const mem = std.mem; |
| 5 | 5 | ||
| 6 | allocator: mem.Allocator, | ||
| 7 | cutoff: u21 = undefined, | 6 | cutoff: u21 = undefined, |
| 8 | cwcf_exceptions_min: u21 = undefined, | 7 | cwcf_exceptions_min: u21 = undefined, |
| 9 | cwcf_exceptions_max: u21 = undefined, | 8 | cwcf_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 | ||
| 56 | pub fn deinit(self: *const Self) void { | 55 | pub 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`. |