From 21d7430696158a3aa486d620bf7251f6134af9b9 Mon Sep 17 00:00:00 2001 From: LeRoyce Pearson Date: Fri, 6 Mar 2020 22:45:48 -0700 Subject: [PATCH] Replace ArrayList in write_manifest with an array --- lib/std/cache_hash.zig | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/std/cache_hash.zig b/lib/std/cache_hash.zig index dc9d5ffed..85e5d703c 100644 --- a/lib/std/cache_hash.zig +++ b/lib/std/cache_hash.zig @@ -271,14 +271,13 @@ pub const CacheHash = struct { pub fn write_manifest(self: *@This()) !void { debug.assert(self.manifest_file != null); - var encoded_digest = try Buffer.initSize(self.alloc, BASE64_DIGEST_LEN); - defer encoded_digest.deinit(); + var encoded_digest: [BASE64_DIGEST_LEN]u8 = undefined; var contents = try Buffer.init(self.alloc, ""); defer contents.deinit(); for (self.files.toSlice()) |file| { - base64_encoder.encode(encoded_digest.toSlice(), &file.bin_digest); - try contents.print("{} {} {} {}\n", .{ file.file_handle, file.stat.mtime, encoded_digest.toSlice(), file.path }); + base64_encoder.encode(encoded_digest[0..], &file.bin_digest); + try contents.print("{} {} {} {}\n", .{ file.file_handle, file.stat.mtime, encoded_digest[0..], file.path }); } try self.manifest_file.?.seekTo(0);