diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-01-08 10:34:45 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-01-08 10:34:45 -0500 |
| commit | 5a8d87f5042b5ab86de7c72df4ce84a314878e40 (patch) | |
| tree | d9a8e14011994c5ebdf4525ea5c5b647aae91a6e /std/buf_map.zig | |
| parent | 38658a597bc22697c2038c21bdec9f04c9973eb8 (diff) | |
| parent | 598170756cd91b6f300921d256baa72141ec3098 (diff) | |
| download | zig-5a8d87f5042b5ab86de7c72df4ce84a314878e40.tar.gz zig-5a8d87f5042b5ab86de7c72df4ce84a314878e40.zip | |
Merge branch 'master' into llvm6
Diffstat (limited to 'std/buf_map.zig')
| -rw-r--r-- | std/buf_map.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/std/buf_map.zig b/std/buf_map.zig index 2a9bd77660..3ff0624f63 100644 --- a/std/buf_map.zig +++ b/std/buf_map.zig @@ -29,16 +29,16 @@ pub const BufMap = struct { pub fn set(self: &BufMap, key: []const u8, value: []const u8) -> %void { if (self.hash_map.get(key)) |entry| { - const value_copy = %return self.copy(value); + const value_copy = try self.copy(value); %defer self.free(value_copy); - _ = %return self.hash_map.put(key, value_copy); + _ = try self.hash_map.put(key, value_copy); self.free(entry.value); } else { - const key_copy = %return self.copy(key); + const key_copy = try self.copy(key); %defer self.free(key_copy); - const value_copy = %return self.copy(value); + const value_copy = try self.copy(value); %defer self.free(value_copy); - _ = %return self.hash_map.put(key_copy, value_copy); + _ = try self.hash_map.put(key_copy, value_copy); } } @@ -68,7 +68,7 @@ pub const BufMap = struct { } fn copy(self: &BufMap, value: []const u8) -> %[]const u8 { - const result = %return self.hash_map.allocator.alloc(u8, value.len); + const result = try self.hash_map.allocator.alloc(u8, value.len); mem.copy(u8, result, value); return result; } |
