Replace ArrayList in write_manifest with an array

master
LeRoyce Pearson 2020-03-06 22:45:48 -07:00 committed by Andrew Kelley
parent 061c1fd9ab
commit 21d7430696
1 changed files with 3 additions and 4 deletions

View File

@ -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);