diff options
author | Christian Segundo | 2022-12-03 19:28:32 +0100 |
---|---|---|
committer | Christian Segundo | 2022-12-03 19:28:32 +0100 |
commit | ee6c6e975dabc6c14f7e8e62e2de1551a431cc7a (patch) | |
tree | 834829061b796f3e6168ec1d6b7e1e8ff4469934 /day-2/util/file.zig | |
parent | 78fa87cd43cd18f2f9ec4a04c45bcb8036143fd8 (diff) | |
download | advent-of-zig-2022-ee6c6e975dabc6c14f7e8e62e2de1551a431cc7a.tar.gz |
refactor to use a meta test
Diffstat (limited to 'day-2/util/file.zig')
-rw-r--r-- | day-2/util/file.zig | 15 |
1 files changed, 0 insertions, 15 deletions
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, - ); -} |