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/CombiningData.zig | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/CombiningData.zig') 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"); const compress = std.compress; const mem = std.mem; -allocator: mem.Allocator, s1: []u16 = undefined, s2: []u8 = undefined, @@ -18,7 +17,7 @@ pub fn init(allocator: mem.Allocator) !Self { const endian = builtin.cpu.arch.endian(); - var self = Self{ .allocator = allocator }; + var self = Self{}; const stage_1_len: u16 = try reader.readInt(u16, endian); self.s1 = try allocator.alloc(u16, stage_1_len); @@ -33,9 +32,9 @@ 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); +pub fn deinit(self: *const Self, allocator: mem.Allocator) void { + allocator.free(self.s1); + allocator.free(self.s2); } /// Returns the canonical combining class for a code point. -- cgit v1.2.3