diff options
author | Julien Dessaux | 2022-08-06 09:44:14 +0200 |
---|---|---|
committer | Julien Dessaux | 2022-08-06 09:44:14 +0200 |
commit | 15c75b9f69b2672ace162ca54c259845fd207dd4 (patch) | |
tree | 9ef9632a34dd6097a26e84b381b2abf833863a48 /src/stackStack.zig | |
parent | Implemented stack transfert (diff) | |
download | zigfunge98-15c75b9f69b2672ace162ca54c259845fd207dd4.tar.gz zigfunge98-15c75b9f69b2672ace162ca54c259845fd207dd4.tar.bz2 zigfunge98-15c75b9f69b2672ace162ca54c259845fd207dd4.zip |
Do not add the top of the stack stack on the array list
Diffstat (limited to '')
-rw-r--r-- | src/stackStack.zig | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/stackStack.zig b/src/stackStack.zig index 717be3d..eba4dd7 100644 --- a/src/stackStack.zig +++ b/src/stackStack.zig @@ -6,6 +6,7 @@ pub const StackStack = struct { data: std.ArrayList(*stack.Stack), toss: *stack.Stack, pub fn deinit(self: *StackStack) void { + self.toss.deinit(); for (self.data.items) |s| { s.deinit(); } @@ -18,9 +19,7 @@ pub const StackStack = struct { ss.allocator = allocator; ss.data = std.ArrayList(*stack.Stack).init(allocator); errdefer ss.data.deinit(); - var s = try ss.data.addOne(); - s.* = try stack.Stack.init(allocator); - ss.toss = s.*; + ss.toss = try stack.Stack.init(allocator); return ss; } pub inline fn toss(self: *StackStack) *stack.Stack { |