diff --git a/std/debug.zig b/std/debug.zig index 6ea77c03c565db3995cf157884c003c41ac87343..4051ff123abbebaaae55511be31f34f40afe19ad 100644 --- a/std/debug.zig +++ b/std/debug.zig @@ -196,7 +196,7 @@ fn getString(st: &ElfStackTrace, offset: u64) -> %[]u8 { fn readAllocBytes(in_stream: &io.InStream, size: usize) -> %[]u8 { const buf = %return global_allocator.alloc(u8, size); - %defer global_allocator.free(u8, buf); + %defer global_allocator.free(buf); %return in_stream.read(buf); return buf; } diff --git a/std/elf.zig b/std/elf.zig index a48987f559258f3c0bf67db1b67d5146d7ecd768..704f1e1870d643c6352aed9f47405d8d38447201 100644 --- a/std/elf.zig +++ b/std/elf.zig @@ -180,7 +180,7 @@ pub const Elf = struct { %return elf.in_stream.seekTo(elf.section_header_offset); elf.section_headers = %return elf.allocator.alloc(SectionHeader, sh_entry_count); - %defer elf.allocator.free(SectionHeader, elf.section_headers); + %defer elf.allocator.free(elf.section_headers); if (elf.is_64) { if (sh_entry_size != 64) return error.InvalidFormat; @@ -231,7 +231,7 @@ pub const Elf = struct { } pub fn close(elf: &Elf) { - elf.allocator.free(SectionHeader, elf.section_headers); + elf.allocator.free(elf.section_headers); if (elf.auto_close_stream) elf.in_stream.close(); diff --git a/std/hash_map.zig b/std/hash_map.zig index 27c80b787e0c496793c7ad1f72cd302316b924d1..4cdf098d5a811b5bf48cde009b9e73cedbb02a84 100644 --- a/std/hash_map.zig +++ b/std/hash_map.zig @@ -63,7 +63,7 @@ pub fn HashMap(comptime K: type, comptime V: type, comptime hash: fn(key: K)->u3 } pub fn deinit(hm: &Self) { - hm.allocator.free(Entry, hm.entries); + hm.allocator.free(hm.entries); } pub fn clear(hm: &Self) { @@ -91,7 +91,7 @@ pub fn HashMap(comptime K: type, comptime V: type, comptime hash: fn(key: K)->u3 hm.internalPut(old_entry.key, old_entry.value); } } - hm.allocator.free(Entry, old_entries); + hm.allocator.free(old_entries); } hm.internalPut(key, value); diff --git a/std/list.zig b/std/list.zig index b0b4ee2df0c136ab772af6c3d82b815ddbfaac4e..c79505ef50171fd9fdaff65663a2a4f1fd814f56 100644 --- a/std/list.zig +++ b/std/list.zig @@ -20,7 +20,7 @@ pub fn List(comptime T: type) -> type{ } pub fn deinit(l: &Self) { - l.allocator.free(T, l.items); + l.allocator.free(l.items); } pub fn toSlice(l: &const Self) -> []const T { diff --git a/std/mem.zig b/std/mem.zig index 9059f9580da1a3462ac3575223eac94a5f7fb11e..8aa18348b2c1acb38c77ceb44e914c379b4c59d7 100644 --- a/std/mem.zig +++ b/std/mem.zig @@ -35,8 +35,7 @@ pub const Allocator = struct { ([]T)(%return self.reallocFn(self, ([]u8)(old_mem), byte_count)) } - // TODO mem: []var and get rid of 2nd param - fn free(self: &Allocator, comptime T: type, mem: []T) { + fn free(self: &Allocator, mem: var) { self.freeFn(self, ([]u8)(mem)); } };