summaryrefslogtreecommitdiff
path: root/src/GenCatData.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/GenCatData.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/GenCatData.zig')
-rw-r--r--src/GenCatData.zig11
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
40allocator: mem.Allocator,
41s1: []u16 = undefined, 40s1: []u16 = undefined,
42s2: []u5 = undefined, 41s2: []u5 = undefined,
43s3: []u5 = undefined, 42s3: []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
76pub fn deinit(self: *const Self) void { 75pub 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`.