diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-06-01 11:49:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-01 11:49:25 -0400 |
| commit | 3918e7699db07540d59aeef7728e5dff54d9e874 (patch) | |
| tree | 5ccfd67157be19b745c469e923ed92691670b6e9 /std/buf_set.zig | |
| parent | 717ac85a5acb5e6ae063c4d0eb3b8f1bd260776a (diff) | |
| parent | e29d12d8218c6f84d4fd59b7c8672d3b38c79390 (diff) | |
| download | zig-3918e7699db07540d59aeef7728e5dff54d9e874.tar.gz zig-3918e7699db07540d59aeef7728e5dff54d9e874.zip | |
Merge pull request #1032 from ziglang/pointer-reform
use * for pointer type instead of &
Diffstat (limited to 'std/buf_set.zig')
| -rw-r--r-- | std/buf_set.zig | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/std/buf_set.zig b/std/buf_set.zig index c5a80e16fb..03a050ed8b 100644 --- a/std/buf_set.zig +++ b/std/buf_set.zig @@ -9,12 +9,12 @@ pub const BufSet = struct { const BufSetHashMap = HashMap([]const u8, void, mem.hash_slice_u8, mem.eql_slice_u8); - pub fn init(a: &Allocator) BufSet { + pub fn init(a: *Allocator) BufSet { var self = BufSet{ .hash_map = BufSetHashMap.init(a) }; return self; } - pub fn deinit(self: &const BufSet) void { + pub fn deinit(self: *const BufSet) void { var it = self.hash_map.iterator(); while (true) { const entry = it.next() ?? break; @@ -24,7 +24,7 @@ pub const BufSet = struct { self.hash_map.deinit(); } - pub fn put(self: &BufSet, key: []const u8) !void { + pub fn put(self: *BufSet, key: []const u8) !void { if (self.hash_map.get(key) == null) { const key_copy = try self.copy(key); errdefer self.free(key_copy); @@ -32,28 +32,28 @@ pub const BufSet = struct { } } - pub fn delete(self: &BufSet, key: []const u8) void { + pub fn delete(self: *BufSet, key: []const u8) void { const entry = self.hash_map.remove(key) ?? return; self.free(entry.key); } - pub fn count(self: &const BufSet) usize { + pub fn count(self: *const BufSet) usize { return self.hash_map.count(); } - pub fn iterator(self: &const BufSet) BufSetHashMap.Iterator { + pub fn iterator(self: *const BufSet) BufSetHashMap.Iterator { return self.hash_map.iterator(); } - pub fn allocator(self: &const BufSet) &Allocator { + pub fn allocator(self: *const BufSet) *Allocator { return self.hash_map.allocator; } - fn free(self: &const BufSet, value: []const u8) void { + fn free(self: *const BufSet, value: []const u8) void { self.hash_map.allocator.free(value); } - fn copy(self: &const BufSet, value: []const u8) ![]const u8 { + fn copy(self: *const BufSet, value: []const u8) ![]const u8 { const result = try self.hash_map.allocator.alloc(u8, value.len); mem.copy(u8, result, value); return result; |
