Skip to content

Commit

Permalink
refactor: drop redundant deinit() in height:
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesrocket committed Sep 5, 2024
1 parent a73ce17 commit 5f8dfbe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ fn printCells(core: *Core, handler: *Handler, rand: std.rand.Random) !void {
} else {
height: for (0..@intCast(core.height)) |_| {
var arr = std.ArrayList(?u8).init(core.allocator);
defer arr.deinit();

for (0..@intCast(core.width)) |_| {
const rand_int = switch (handler.mode) {
Expand Down Expand Up @@ -307,11 +306,12 @@ fn printCells(core: *Core, handler: *Handler, rand: std.rand.Random) !void {
if (core.lines.?.items.len == core.height) {
const old_line = core.lines.?.pop();
core.allocator.free(old_line);

try core.lines.?.insert(0, slice);
break :height;
} else {
try core.lines.?.insert(0, slice);
}

try core.lines.?.insert(0, slice);
}

for (0..core.lines.?.items.len) |h| {
Expand Down

0 comments on commit 5f8dfbe

Please sign in to comment.