Skip to content

Commit

Permalink
Remove unnecessary contents field from File
Browse files Browse the repository at this point in the history
It was causing a segfault on `mipsel` architecture, not sure why other
architectures weren't affected.
  • Loading branch information
leroycep committed Apr 8, 2020
1 parent 76dcfb3 commit 88bb407
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/std/cache_hash.zig
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@ pub const File = struct {
path: ?[]const u8,
stat: fs.File.Stat,
bin_digest: [BIN_DIGEST_LEN]u8,
contents: ?[]const u8,

pub fn deinit(self: *@This(), alloc: *Allocator) void {
if (self.path) |owned_slice| {
alloc.free(owned_slice);
self.path = null;
}
if (self.contents) |owned_slice| {
alloc.free(owned_slice);
self.contents = null;
}
}
};

Expand Down Expand Up @@ -232,7 +227,7 @@ pub const CacheHash = struct {
if (idx < input_file_count or idx == 0) {
self.manifest_dirty = true;
while (idx < input_file_count) : (idx += 1) {
var cache_hash_file = self.files.ptrAt(idx);
var cache_hash_file = &self.files.items[idx];
self.populate_file_hash(cache_hash_file) catch |err| {
self.manifest_file.?.close();
self.manifest_file = null;
Expand Down Expand Up @@ -318,7 +313,7 @@ fn hash_file(alloc: *Allocator, bin_digest: []u8, handle: *const fs.File) !void
blake3.final(bin_digest);
}

test "cache file and the recall it" {
test "cache file and then recall it" {
const cwd = fs.cwd();

const temp_file = "test.txt";
Expand Down

0 comments on commit 88bb407

Please sign in to comment.