authorgravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-04-07 23:57:59-06:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-25 13:48:43-04:00
log204aa7dc1a183bb5fba91328d4f436c6f91471af
treee8a5e606b4a290f5bcc8958bb07d16943884df31
parentc88ece3679863cd55895bb9696d304c8d8754a4a

Remove unnecessary contents field from File

It was causing a segfault on `mipsel` architecture, not sure why other architectures weren't affected.

1 files changed, 2 insertions(+), 7 deletions(-)

lib/std/cache_hash.zig+2-7
......@@ -18,17 +18,12 @@ pub const File = struct {
1818 path: ?[]const u8,
1919 stat: fs.File.Stat,
2020 bin_digest: [BIN_DIGEST_LEN]u8,
21 contents: ?[]const u8,
2221
2322 pub fn deinit(self: *@This(), alloc: *Allocator) void {
2423 if (self.path) |owned_slice| {
2524 alloc.free(owned_slice);
2625 self.path = null;
2726 }
28 if (self.contents) |owned_slice| {
29 alloc.free(owned_slice);
30 self.contents = null;
31 }
3227 }
3328};
3429
......@@ -232,7 +227,7 @@ pub const CacheHash = struct {
232227 if (idx < input_file_count or idx == 0) {
233228 self.manifest_dirty = true;
234229 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];
236231 self.populate_file_hash(cache_hash_file) catch |err| {
237232 self.manifest_file.?.close();
238233 self.manifest_file = null;
......@@ -318,7 +313,7 @@ fn hash_file(alloc: *Allocator, bin_digest: []u8, handle: *const fs.File) !void
318313 blake3.final(bin_digest);
319314}
320315
321test "cache file and the recall it" {
316test "cache file and then recall it" {
322317 const cwd = fs.cwd();
323318
324319 const temp_file = "test.txt";