From ee6c6e975dabc6c14f7e8e62e2de1551a431cc7a Mon Sep 17 00:00:00 2001 From: Christian Segundo Date: Sat, 3 Dec 2022 19:28:32 +0100 Subject: refactor to use a meta test --- day-2/util/file.zig | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 day-2/util/file.zig (limited to 'day-2/util/file.zig') diff --git a/day-2/util/file.zig b/day-2/util/file.zig deleted file mode 100644 index 90849e9..0000000 --- a/day-2/util/file.zig +++ /dev/null @@ -1,15 +0,0 @@ -const std = @import("std"); - -/// Reads an entire file into memory, caller owns the returned slice. -pub fn slurp(allocator: std.mem.Allocator, file_path: []const u8) ![]u8 { - var path_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined; - const path = try std.fs.realpath(file_path, &path_buffer); - - const file = try std.fs.openFileAbsolute(path, .{}); - defer file.close(); - - return try file.readToEndAlloc( - allocator, - (try file.stat()).size, - ); -} -- cgit v1.2.3