| ... | @@ -18,17 +18,12 @@ pub const File = struct { | ... | @@ -18,17 +18,12 @@ pub const File = struct { |
| 18 | path: ?[]const u8, | 18 | path: ?[]const u8, |
| 19 | stat: fs.File.Stat, | 19 | stat: fs.File.Stat, |
| 20 | bin_digest: [BIN_DIGEST_LEN]u8, | 20 | bin_digest: [BIN_DIGEST_LEN]u8, |
| 21 | contents: ?[]const u8, | | |
| 22 | | 21 | |
| 23 | pub fn deinit(self: *@This(), alloc: *Allocator) void { | 22 | pub fn deinit(self: *@This(), alloc: *Allocator) void { |
| 24 | if (self.path) |owned_slice| { | 23 | if (self.path) |owned_slice| { |
| 25 | alloc.free(owned_slice); | 24 | alloc.free(owned_slice); |
| 26 | self.path = null; | 25 | self.path = null; |
| 27 | } | 26 | } |
| 28 | if (self.contents) |owned_slice| { | | |
| 29 | alloc.free(owned_slice); | | |
| 30 | self.contents = null; | | |
| 31 | } | | |
| 32 | } | 27 | } |
| 33 | }; | 28 | }; |
| 34 | | 29 | |
| ... | @@ -232,7 +227,7 @@ pub const CacheHash = struct { | ... | @@ -232,7 +227,7 @@ pub const CacheHash = struct { |
| 232 | if (idx < input_file_count or idx == 0) { | 227 | if (idx < input_file_count or idx == 0) { |
| 233 | self.manifest_dirty = true; | 228 | self.manifest_dirty = true; |
| 234 | while (idx < input_file_count) : (idx += 1) { | 229 | while (idx < input_file_count) : (idx += 1) { |
| 235 | var cache_hash_file = self.files.ptrAt(idx); | 230 | var cache_hash_file = &self.files.items[idx]; |
| 236 | self.populate_file_hash(cache_hash_file) catch |err| { | 231 | self.populate_file_hash(cache_hash_file) catch |err| { |
| 237 | self.manifest_file.?.close(); | 232 | self.manifest_file.?.close(); |
| 238 | self.manifest_file = null; | 233 | self.manifest_file = null; |
| ... | @@ -318,7 +313,7 @@ fn hash_file(alloc: *Allocator, bin_digest: []u8, handle: *const fs.File) !void | ... | @@ -318,7 +313,7 @@ fn hash_file(alloc: *Allocator, bin_digest: []u8, handle: *const fs.File) !void |
| 318 | blake3.final(bin_digest); | 313 | blake3.final(bin_digest); |
| 319 | } | 314 | } |
| 320 | | 315 | |
| 321 | test "cache file and the recall it" { | 316 | test "cache file and then recall it" { |
| 322 | const cwd = fs.cwd(); | 317 | const cwd = fs.cwd(); |
| 323 | | 318 | |
| 324 | const temp_file = "test.txt"; | 319 | const temp_file = "test.txt"; |