diff options
| author | 2025-03-25 00:29:52 +0300 | |
|---|---|---|
| committer | 2025-04-29 12:30:55 -0400 | |
| commit | 2f44fdebca57d9eabb682e05d04189d0600b8664 (patch) | |
| tree | 617e7d4be89c1a965848dbc7f9b5f2a273faa9d7 /src/GenCatData.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/GenCatData.zig')
| -rw-r--r-- | src/GenCatData.zig | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/GenCatData.zig b/src/GenCatData.zig index 5ce9fb6..a69f7a2 100644 --- a/src/GenCatData.zig +++ b/src/GenCatData.zig | |||
| @@ -37,7 +37,6 @@ pub const Gc = enum { | |||
| 37 | Zs, // Separator, Space | 37 | Zs, // Separator, Space |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | allocator: mem.Allocator, | ||
| 41 | s1: []u16 = undefined, | 40 | s1: []u16 = undefined, |
| 42 | s2: []u5 = undefined, | 41 | s2: []u5 = undefined, |
| 43 | s3: []u5 = undefined, | 42 | s3: []u5 = undefined, |
| @@ -53,7 +52,7 @@ pub fn init(allocator: mem.Allocator) !Self { | |||
| 53 | 52 | ||
| 54 | const endian = builtin.cpu.arch.endian(); | 53 | const endian = builtin.cpu.arch.endian(); |
| 55 | 54 | ||
| 56 | var self = Self{ .allocator = allocator }; | 55 | var self = Self{}; |
| 57 | 56 | ||
| 58 | const s1_len: u16 = try reader.readInt(u16, endian); | 57 | const s1_len: u16 = try reader.readInt(u16, endian); |
| 59 | self.s1 = try allocator.alloc(u16, s1_len); | 58 | self.s1 = try allocator.alloc(u16, s1_len); |
| @@ -73,10 +72,10 @@ pub fn init(allocator: mem.Allocator) !Self { | |||
| 73 | return self; | 72 | return self; |
| 74 | } | 73 | } |
| 75 | 74 | ||
| 76 | pub fn deinit(self: *const Self) void { | 75 | pub fn deinit(self: *const Self, allocator: mem.Allocator) void { |
| 77 | self.allocator.free(self.s1); | 76 | allocator.free(self.s1); |
| 78 | self.allocator.free(self.s2); | 77 | allocator.free(self.s2); |
| 79 | self.allocator.free(self.s3); | 78 | allocator.free(self.s3); |
| 80 | } | 79 | } |
| 81 | 80 | ||
| 82 | /// Lookup the General Category for `cp`. | 81 | /// Lookup the General Category for `cp`. |