diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-01-07 16:51:46 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-01-07 16:53:13 -0500 |
| commit | 66717db735b9ddac9298bf08fcf95e7e11629fee (patch) | |
| tree | 54dea549c62d851da9269b09eba8e596450ee330 /std/cstr.zig | |
| parent | de1f57926f212f18a98884fa8b1d0df7f7bc7f03 (diff) | |
| download | zig-66717db735b9ddac9298bf08fcf95e7e11629fee.tar.gz zig-66717db735b9ddac9298bf08fcf95e7e11629fee.zip | |
replace `%return` with `try`
See #632
better fits the convention of using keywords for control flow
Diffstat (limited to 'std/cstr.zig')
| -rw-r--r-- | std/cstr.zig | 4 |
1 files changed, 2 insertions, 2 deletions
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; |
