Skip to content

Commit

Permalink
Use zig 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
booniepepper committed Jan 13, 2022
1 parent a77b2b6 commit b80a148
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
zig 0.8.0

zig 0.9.0
9 changes: 5 additions & 4 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ const USAGE =

pub fn main() anyerror!void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
var alloc = arena.allocator();
defer arena.deinit();
var buf: [MAX_PATH_BYTES]u8 = undefined;

const findup = initFindup(&arena.allocator) catch |err| {
const findup = initFindup(alloc) catch |err| {
try stderr.print("ERROR: {e}\n{s}", .{ err, USAGE });
std.os.exit(1);
};
Expand Down Expand Up @@ -59,11 +60,11 @@ pub fn main() anyerror!void {
try stdout.print("{s}\n", .{result.?});
}

fn initFindup(allocator: *std.mem.Allocator) anyerror!Findup {
fn initFindup(alloc: std.mem.Allocator) anyerror!Findup {
var args = std.process.args();

const program = try args.next(allocator).?;
const maybeTarget = args.next(allocator);
const program = try args.next(alloc).?;
const maybeTarget = args.next(alloc);
const target = if (maybeTarget == null) return FindupError.NoFileSpecified else try maybeTarget.?;
const cwd = std.fs.cwd();

Expand Down

0 comments on commit b80a148

Please sign in to comment.