aboutsummaryrefslogtreecommitdiff
path: root/common.zig
diff options
context:
space:
mode:
Diffstat (limited to 'common.zig')
-rw-r--r--common.zig11
1 files changed, 3 insertions, 8 deletions
diff --git a/common.zig b/common.zig
index f724940..c38beb1 100644
--- a/common.zig
+++ b/common.zig
@@ -2,16 +2,13 @@ const std = @import("std");
pub const Setup = struct {
pub const Part = enum { pt1, pt2 };
-
- gpa: std.heap.GeneralPurposeAllocator(.{}),
a: std.mem.Allocator,
input: []const u8,
part: Part,
- pub fn get() !Setup {
+ pub fn get(a: std.mem.Allocator) !Setup {
var res: Setup = undefined;
- res.gpa = std.heap.GeneralPurposeAllocator(.{}){};
- res.a = res.gpa.allocator();
+ res.a = a;
var p = std.process.args();
var file: []const u8 = "";
if (!p.skip()) return error.NoProgramName;
@@ -39,8 +36,6 @@ pub const Setup = struct {
return res;
}
pub fn deinit(self: *Setup) void {
- _ = self;
- //self.a.free(self.input); // For some reason this is freezing
- //_ = self.gpa.deinit(); // and if we don't free, then gpa.deinit whinges that we leaked memory :)
+ self.a.free(self.input); // For some reason this is freezing
}
};