| ... | @@ -2446,12 +2446,14 @@ pub const Allocating = struct { | ... | @@ -2446,12 +2446,14 @@ pub const Allocating = struct { |
| 2446 | | 2446 | |
| 2447 | pub fn toOwnedSlice(a: *Allocating) error{OutOfMemory}![]u8 { | 2447 | pub fn toOwnedSlice(a: *Allocating) error{OutOfMemory}![]u8 { |
| 2448 | var list = a.toArrayList(); | 2448 | var list = a.toArrayList(); |
| | 2449 | defer a.setArrayList(list); |
| 2449 | return list.toOwnedSlice(a.allocator); | 2450 | return list.toOwnedSlice(a.allocator); |
| 2450 | } | 2451 | } |
| 2451 | | 2452 | |
| 2452 | pub fn toOwnedSliceSentinel(a: *Allocating, comptime sentinel: u8) error{OutOfMemory}![:sentinel]u8 { | 2453 | pub fn toOwnedSliceSentinel(a: *Allocating, comptime sentinel: u8) error{OutOfMemory}![:sentinel]u8 { |
| 2453 | const gpa = a.allocator; | 2454 | const gpa = a.allocator; |
| 2454 | var list = toArrayList(a); | 2455 | var list = toArrayList(a); |
| | 2456 | defer a.setArrayList(list); |
| 2455 | return list.toOwnedSliceSentinel(gpa, sentinel); | 2457 | return list.toOwnedSliceSentinel(gpa, sentinel); |
| 2456 | } | 2458 | } |
| 2457 | | 2459 | |