From 2f44fdebca57d9eabb682e05d04189d0600b8664 Mon Sep 17 00:00:00 2001 From: lch361 Date: Tue, 25 Mar 2025 00:29:52 +0300 Subject: All the std.mem.Allocators that were stored just for init and deinit methods were removed, mem.Allocators were added to deinit as arguments. --- src/GenCatData.zig | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/GenCatData.zig') 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 { Zs, // Separator, Space }; -allocator: mem.Allocator, s1: []u16 = undefined, s2: []u5 = undefined, s3: []u5 = undefined, @@ -53,7 +52,7 @@ pub fn init(allocator: mem.Allocator) !Self { const endian = builtin.cpu.arch.endian(); - var self = Self{ .allocator = allocator }; + var self = Self{}; const s1_len: u16 = try reader.readInt(u16, endian); self.s1 = try allocator.alloc(u16, s1_len); @@ -73,10 +72,10 @@ pub fn init(allocator: mem.Allocator) !Self { return self; } -pub fn deinit(self: *const Self) void { - self.allocator.free(self.s1); - self.allocator.free(self.s2); - self.allocator.free(self.s3); +pub fn deinit(self: *const Self, allocator: mem.Allocator) void { + allocator.free(self.s1); + allocator.free(self.s2); + allocator.free(self.s3); } /// Lookup the General Category for `cp`. -- cgit v1.2.3