mirror of
https://codeberg.org/andyscott/advent-of-code.git
synced 2024-12-22 01:23:11 -05:00
2024: Day 1: use new util.zig
This commit is contained in:
parent
efc1516acc
commit
332eaae6ee
1 changed files with 3 additions and 6 deletions
|
@ -1,16 +1,13 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const print = std.debug.print;
|
const print = std.debug.print;
|
||||||
|
|
||||||
pub fn main() !void {
|
const util = @import("util.zig");
|
||||||
const file = try std.fs.cwd().openFile("day1.txt", .{});
|
|
||||||
defer file.close();
|
|
||||||
|
|
||||||
|
pub fn main() !void {
|
||||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||||
defer std.debug.assert(gpa.deinit() == .ok);
|
|
||||||
const allocator = gpa.allocator();
|
const allocator = gpa.allocator();
|
||||||
|
|
||||||
const stat = try file.stat();
|
const input = try util.readAllInput(1, allocator);
|
||||||
const input = try file.reader().readAllAlloc(allocator, stat.size);
|
|
||||||
defer allocator.free(input);
|
defer allocator.free(input);
|
||||||
|
|
||||||
var l1 = std.ArrayList(i32).init(allocator);
|
var l1 = std.ArrayList(i32).init(allocator);
|
||||||
|
|
Loading…
Reference in a new issue