diff options
| author | 2025-03-25 00:29:52 +0300 | |
|---|---|---|
| committer | 2025-04-29 12:30:55 -0400 | |
| commit | 2f44fdebca57d9eabb682e05d04189d0600b8664 (patch) | |
| tree | 617e7d4be89c1a965848dbc7f9b5f2a273faa9d7 /src/HangulData.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/HangulData.zig')
| -rw-r--r-- | src/HangulData.zig | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/HangulData.zig b/src/HangulData.zig index 048841d..4bccbe6 100644 --- a/src/HangulData.zig +++ b/src/HangulData.zig | |||
| @@ -13,7 +13,6 @@ pub const Syllable = enum { | |||
| 13 | T, | 13 | T, |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | allocator: mem.Allocator, | ||
| 17 | s1: []u16 = undefined, | 16 | s1: []u16 = undefined, |
| 18 | s2: []u3 = undefined, | 17 | s2: []u3 = undefined, |
| 19 | 18 | ||
| @@ -27,7 +26,7 @@ pub fn init(allocator: mem.Allocator) !Self { | |||
| 27 | var reader = in_decomp.reader(); | 26 | var reader = in_decomp.reader(); |
| 28 | 27 | ||
| 29 | const endian = builtin.cpu.arch.endian(); | 28 | const endian = builtin.cpu.arch.endian(); |
| 30 | var self = Self{ .allocator = allocator }; | 29 | var self = Self{}; |
| 31 | 30 | ||
| 32 | const stage_1_len: u16 = try reader.readInt(u16, endian); | 31 | const stage_1_len: u16 = try reader.readInt(u16, endian); |
| 33 | self.s1 = try allocator.alloc(u16, stage_1_len); | 32 | self.s1 = try allocator.alloc(u16, stage_1_len); |
| @@ -42,9 +41,9 @@ pub fn init(allocator: mem.Allocator) !Self { | |||
| 42 | return self; | 41 | return self; |
| 43 | } | 42 | } |
| 44 | 43 | ||
| 45 | pub fn deinit(self: *const Self) void { | 44 | pub fn deinit(self: *const Self, allocator: mem.Allocator) void { |
| 46 | self.allocator.free(self.s1); | 45 | allocator.free(self.s1); |
| 47 | self.allocator.free(self.s2); | 46 | allocator.free(self.s2); |
| 48 | } | 47 | } |
| 49 | 48 | ||
| 50 | /// Returns the Hangul syllable type for `cp`. | 49 | /// Returns the Hangul syllable type for `cp`. |