chore: improve init/deinit methods

This commit is contained in:
2022-08-29 00:32:41 -05:00
parent aa52bb5917
commit 5f8c6833f4
11 changed files with 100 additions and 79 deletions

View File

@@ -27,8 +27,9 @@ pub fn init(alloc: Allocator, maybe_path: ?[]const u8) !Self {
};
}
pub fn deinit(self: Self) void {
pub fn deinit(self: *Self) void {
if (self.buf) |buf| self.alloc.free(buf);
self.* = undefined;
}
pub fn read(self: *Self, comptime T: type, r15: u32, addr: u32) T {