Tweak day 1 code structure

This commit is contained in:
Kienan Stewart 2021-12-02 22:11:06 -05:00
parent 859699bcd0
commit 794cc70d60
1 changed files with 2 additions and 1 deletions

View File

@ -5,12 +5,13 @@ pub fn main() anyerror!void {
defer arena.deinit(); defer arena.deinit();
const alloc = &arena.allocator; const alloc = &arena.allocator;
// Part 1 // Read our input
var f = try std.fs.cwd().openFile("input", .{}); var f = try std.fs.cwd().openFile("input", .{});
defer f.close(); defer f.close();
var contents = try f.readToEndAlloc(alloc, std.math.maxInt(u32)); var contents = try f.readToEndAlloc(alloc, std.math.maxInt(u32));
defer alloc.free(contents); defer alloc.free(contents);
// Part 1
var depths = std.ArrayList(u32).init(alloc); var depths = std.ArrayList(u32).init(alloc);
defer depths.deinit(); defer depths.deinit();