aboutsummaryrefslogtreecommitdiff
path: root/std/buf_map.zig
diff options
context:
space:
mode:
Diffstat (limited to 'std/buf_map.zig')
-rw-r--r--std/buf_map.zig18
1 files changed, 9 insertions, 9 deletions
diff --git a/std/buf_map.zig b/std/buf_map.zig
index 930fc36a78..22d821ae7b 100644
--- a/std/buf_map.zig
+++ b/std/buf_map.zig
@@ -11,12 +11,12 @@ pub const BufMap = struct {
const BufMapHashMap = HashMap([]const u8, []const u8, mem.hash_slice_u8, mem.eql_slice_u8);
- pub fn init(allocator: &Allocator) BufMap {
+ pub fn init(allocator: *Allocator) BufMap {
var self = BufMap{ .hash_map = BufMapHashMap.init(allocator) };
return self;
}
- pub fn deinit(self: &const BufMap) void {
+ pub fn deinit(self: *const BufMap) void {
var it = self.hash_map.iterator();
while (true) {
const entry = it.next() ?? break;
@@ -27,7 +27,7 @@ pub const BufMap = struct {
self.hash_map.deinit();
}
- pub fn set(self: &BufMap, key: []const u8, value: []const u8) !void {
+ pub fn set(self: *BufMap, key: []const u8, value: []const u8) !void {
self.delete(key);
const key_copy = try self.copy(key);
errdefer self.free(key_copy);
@@ -36,30 +36,30 @@ pub const BufMap = struct {
_ = try self.hash_map.put(key_copy, value_copy);
}
- pub fn get(self: &const BufMap, key: []const u8) ?[]const u8 {
+ pub fn get(self: *const BufMap, key: []const u8) ?[]const u8 {
const entry = self.hash_map.get(key) ?? return null;
return entry.value;
}
- pub fn delete(self: &BufMap, key: []const u8) void {
+ pub fn delete(self: *BufMap, key: []const u8) void {
const entry = self.hash_map.remove(key) ?? return;
self.free(entry.key);
self.free(entry.value);
}
- pub fn count(self: &const BufMap) usize {
+ pub fn count(self: *const BufMap) usize {
return self.hash_map.count();
}
- pub fn iterator(self: &const BufMap) BufMapHashMap.Iterator {
+ pub fn iterator(self: *const BufMap) BufMapHashMap.Iterator {
return self.hash_map.iterator();
}
- fn free(self: &const BufMap, value: []const u8) void {
+ fn free(self: *const BufMap, value: []const u8) void {
self.hash_map.allocator.free(value);
}
- fn copy(self: &const BufMap, value: []const u8) ![]const u8 {
+ fn copy(self: *const BufMap, value: []const u8) ![]const u8 {
return mem.dupe(self.hash_map.allocator, u8, value);
}
};