From 2e4229d613552ae154769236924574dd4de425b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sun, 3 Jul 2022 06:39:33 +0300 Subject: [PATCH] main: trivial errors --- build.zig | 2 +- src/unix2db/main.zig | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build.zig b/build.zig index 0e40678..33b117d 100644 --- a/build.zig +++ b/build.zig @@ -51,7 +51,7 @@ pub fn build(b: *zbs.Builder) void { cmph.addIncludeDir("include/deps/cmph"); { - const exe = b.addExecutable("turbo-unix2db", "cli/unix2db/main.zig"); + const exe = b.addExecutable("turbo-unix2db", "src/unix2db/main.zig"); exe.setTarget(target); exe.setBuildMode(mode); addCmphDeps(exe, cmph); diff --git a/src/unix2db/main.zig b/src/unix2db/main.zig index cff7ebf..5eed32f 100644 --- a/src/unix2db/main.zig +++ b/src/unix2db/main.zig @@ -26,12 +26,14 @@ const usage = pub fn main() !void { // This line is here because of https://github.com/ziglang/zig/issues/7807 const argv: []const [*:0]const u8 = os.argv; - const gpa = GeneralPurposeAllocator(.{}); + var gpa = GeneralPurposeAllocator(.{}){}; + defer gpa.deinit(); + const allocator = gpa.allocator(); - const stderr = try io.getStdErr(); - const stdout = try io.getStdOut(); + const stderr = io.getStdErr().writer(); + const stdout = io.getStdOut().writer(); - const return_code = execute(gpa, stdout, stderr, argv[1..]); + const return_code = execute(allocator, stdout, stderr, argv[1..]); os.exit(return_code); }