From 66717db735b9ddac9298bf08fcf95e7e11629fee Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 7 Jan 2018 16:51:46 -0500 Subject: replace `%return` with `try` See #632 better fits the convention of using keywords for control flow --- std/cstr.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'std/cstr.zig') diff --git a/std/cstr.zig b/std/cstr.zig index 1610f12481..0f63592950 100644 --- a/std/cstr.zig +++ b/std/cstr.zig @@ -43,7 +43,7 @@ fn testCStrFnsImpl() { /// have a null byte after it. /// Caller owns the returned memory. pub fn addNullByte(allocator: &mem.Allocator, slice: []const u8) -> %[]u8 { - const result = %return allocator.alloc(u8, slice.len + 1); + const result = try allocator.alloc(u8, slice.len + 1); mem.copy(u8, result, slice); result[slice.len] = 0; return result; @@ -70,7 +70,7 @@ pub const NullTerminated2DArray = struct { const index_size = @sizeOf(usize) * new_len; // size of the ptrs byte_count += index_size; - const buf = %return allocator.alignedAlloc(u8, @alignOf(?&u8), byte_count); + const buf = try allocator.alignedAlloc(u8, @alignOf(?&u8), byte_count); %defer allocator.free(buf); var write_index = index_size; -- cgit v1.2.3