mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
CBE: Don't expose openCFile, always close file after an update
This commit is contained in:
parent
6b48634166
commit
d060be8804
@ -86,7 +86,7 @@ pub fn writeFilePath(
|
||||
return result;
|
||||
}
|
||||
|
||||
pub fn openCFile(allocator: *Allocator, file: fs.File, options: Options) !File.C {
|
||||
fn openCFile(allocator: *Allocator, file: fs.File, options: Options) !File.C {
|
||||
return File.C{
|
||||
.allocator = allocator,
|
||||
.file = file,
|
||||
@ -282,6 +282,8 @@ pub const File = struct {
|
||||
}
|
||||
}
|
||||
try writer.writeAll(self.main.items);
|
||||
self.file.?.close();
|
||||
self.file = null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -480,9 +480,8 @@ pub const TestContext = struct {
|
||||
switch (update.case) {
|
||||
.Transformation => |expected_output| {
|
||||
if (case.cbe) {
|
||||
var cfile: *link.File.C = module.bin_file.cast(link.File.C).?;
|
||||
cfile.file.?.close();
|
||||
cfile.file = null;
|
||||
// The C file is always closed after an update, because we don't support
|
||||
// incremental updates
|
||||
var file = try tmp.dir.openFile(bin_name, .{ .read = true });
|
||||
defer file.close();
|
||||
var out = file.reader().readAllAlloc(allocator, 1024 * 1024) catch @panic("Unable to read C output!");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user