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/array_list.zig | |
| parent | 38658a597bc22697c2038c21bdec9f04c9973eb8 (diff) | |
| parent | 598170756cd91b6f300921d256baa72141ec3098 (diff) | |
| download | zig-5a8d87f5042b5ab86de7c72df4ce84a314878e40.tar.gz zig-5a8d87f5042b5ab86de7c72df4ce84a314878e40.zip | |
Merge branch 'master' into llvm6
Diffstat (limited to 'std/array_list.zig')
| -rw-r--r-- | std/array_list.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/std/array_list.zig b/std/array_list.zig index db5581dc08..f07b9fb7f5 100644 --- a/std/array_list.zig +++ b/std/array_list.zig @@ -60,18 +60,18 @@ pub fn AlignedArrayList(comptime T: type, comptime A: u29) -> type{ } pub fn append(l: &Self, item: &const T) -> %void { - const new_item_ptr = %return l.addOne(); + const new_item_ptr = try l.addOne(); *new_item_ptr = *item; } pub fn appendSlice(l: &Self, items: []align(A) const T) -> %void { - %return l.ensureCapacity(l.len + items.len); + try l.ensureCapacity(l.len + items.len); mem.copy(T, l.items[l.len..], items); l.len += items.len; } pub fn resize(l: &Self, new_len: usize) -> %void { - %return l.ensureCapacity(new_len); + try l.ensureCapacity(new_len); l.len = new_len; } @@ -87,12 +87,12 @@ pub fn AlignedArrayList(comptime T: type, comptime A: u29) -> type{ better_capacity += better_capacity / 2 + 8; if (better_capacity >= new_capacity) break; } - l.items = %return l.allocator.alignedRealloc(T, A, l.items, better_capacity); + l.items = try l.allocator.alignedRealloc(T, A, l.items, better_capacity); } pub fn addOne(l: &Self) -> %&T { const new_length = l.len + 1; - %return l.ensureCapacity(new_length); + try l.ensureCapacity(new_length); const result = &l.items[l.len]; l.len = new_length; return result; |
