aboutsummaryrefslogtreecommitdiff
path: root/std/buf_map.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-05-10 11:37:25 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-05-10 11:37:25 -0400
commit284ab109c4b83f7bb9a832f284f706e641b002fd (patch)
treed7dc258a7e0676a9867e7941d8605074b57ea74a /std/buf_map.zig
parent7e37d268c86ccc823c4a381a42029722d36c3975 (diff)
parentefa39c5343e13a13e65210f55da5df23ee3feb3e (diff)
downloadzig-284ab109c4b83f7bb9a832f284f706e641b002fd.tar.gz
zig-284ab109c4b83f7bb9a832f284f706e641b002fd.zip
Merge remote-tracking branch 'origin/master' into llvm7
Diffstat (limited to 'std/buf_map.zig')
-rw-r--r--std/buf_map.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/std/buf_map.zig b/std/buf_map.zig
index 3b88b7a753..57c5830bbe 100644
--- a/std/buf_map.zig
+++ b/std/buf_map.zig
@@ -18,10 +18,10 @@ pub const BufMap = struct {
return self;
}
- pub fn deinit(self: &BufMap) void {
+ pub fn deinit(self: &const BufMap) void {
var it = self.hash_map.iterator();
while (true) {
- const entry = it.next() ?? break;
+ const entry = it.next() ?? break;
self.free(entry.key);
self.free(entry.value);
}
@@ -38,7 +38,7 @@ pub const BufMap = struct {
_ = try self.hash_map.put(key_copy, value_copy);
}
- pub fn get(self: &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;
}
@@ -57,11 +57,11 @@ pub const BufMap = struct {
return self.hash_map.iterator();
}
- fn free(self: &BufMap, value: []const u8) void {
+ fn free(self: &const BufMap, value: []const u8) void {
self.hash_map.allocator.free(value);
}
- fn copy(self: &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);
}
};
@@ -87,4 +87,4 @@ test "BufMap" {
bufmap.delete("x");
assert(0 == bufmap.count());
-} \ No newline at end of file
+}