chore: better conform to zig idioms

This commit is contained in:
2022-09-03 18:30:48 -03:00
parent 59669ba3a5
commit 3fb7f2f814
8 changed files with 55 additions and 71 deletions

View File

@@ -5,20 +5,20 @@ const ewram_size = 0x40000;
const Self = @This();
buf: []u8,
alloc: Allocator,
allocator: Allocator,
pub fn init(alloc: Allocator) !Self {
const buf = try alloc.alloc(u8, ewram_size);
pub fn init(allocator: Allocator) !Self {
const buf = try allocator.alloc(u8, ewram_size);
std.mem.set(u8, buf, 0);
return Self{
.buf = buf,
.alloc = alloc,
.allocator = allocator,
};
}
pub fn deinit(self: *Self) void {
self.alloc.free(self.buf);
self.allocator.free(self.buf);
self.* = undefined;
}