diff options
| author | 2025-03-25 00:29:52 +0300 | |
|---|---|---|
| committer | 2025-04-29 12:30:55 -0400 | |
| commit | 2f44fdebca57d9eabb682e05d04189d0600b8664 (patch) | |
| tree | 617e7d4be89c1a965848dbc7f9b5f2a273faa9d7 /src/CombiningData.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/CombiningData.zig')
| -rw-r--r-- | src/CombiningData.zig | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/CombiningData.zig b/src/CombiningData.zig index 44140f8..b5e227a 100644 --- a/src/CombiningData.zig +++ b/src/CombiningData.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 | s1: []u16 = undefined, | 6 | s1: []u16 = undefined, |
| 8 | s2: []u8 = undefined, | 7 | s2: []u8 = undefined, |
| 9 | 8 | ||
| @@ -18,7 +17,7 @@ pub fn init(allocator: mem.Allocator) !Self { | |||
| 18 | 17 | ||
| 19 | const endian = builtin.cpu.arch.endian(); | 18 | const endian = builtin.cpu.arch.endian(); |
| 20 | 19 | ||
| 21 | var self = Self{ .allocator = allocator }; | 20 | var self = Self{}; |
| 22 | 21 | ||
| 23 | const stage_1_len: u16 = try reader.readInt(u16, endian); | 22 | const stage_1_len: u16 = try reader.readInt(u16, endian); |
| 24 | self.s1 = try allocator.alloc(u16, stage_1_len); | 23 | self.s1 = try allocator.alloc(u16, stage_1_len); |
| @@ -33,9 +32,9 @@ pub fn init(allocator: mem.Allocator) !Self { | |||
| 33 | return self; | 32 | return self; |
| 34 | } | 33 | } |
| 35 | 34 | ||
| 36 | pub fn deinit(self: *const Self) void { | 35 | pub fn deinit(self: *const Self, allocator: mem.Allocator) void { |
| 37 | self.allocator.free(self.s1); | 36 | allocator.free(self.s1); |
| 38 | self.allocator.free(self.s2); | 37 | allocator.free(self.s2); |
| 39 | } | 38 | } |
| 40 | 39 | ||
| 41 | /// Returns the canonical combining class for a code point. | 40 | /// Returns the canonical combining class for a code point. |