diff --git a/std/coff.zig b/std/coff.zig index 2c65da5e9ecf38476fd3b864de8e6a39daf96322..9fdc3688787276c00f27d7bf17c52b9cadd18c17 100644 --- a/std/coff.zig +++ b/std/coff.zig @@ -39,6 +39,18 @@ pub const Coff = struct { guid: [16]u8, age: u32, + pub fn init(allocator: *mem.Allocator, in_file: File) Coff { + return Coff{ + .in_file = in_file, + .allocator = allocator, + .coff_header = undefined, + .pe_header = undefined, + .sections = ArrayList(Section).init(allocator), + .guid = undefined, + .age = undefined, + }; + } + pub fn loadHeader(self: *Coff) !void { const pe_pointer_offset = 0x3C; diff --git a/std/debug.zig b/std/debug.zig index 09c89befed9c1ed913c60a51976f7dc36c3f263f..c802f06c0442128b2c3538c5406bb2c21ca77755 100644 --- a/std/debug.zig +++ b/std/debug.zig @@ -800,15 +800,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { defer self_file.close(); const coff_obj = try allocator.create(coff.Coff); - coff_obj.* = coff.Coff{ - .in_file = self_file, - .allocator = allocator, - .coff_header = undefined, - .pe_header = undefined, - .sections = ArrayList(coff.Section).init(allocator), - .guid = undefined, - .age = undefined, - }; + coff_obj.* = coff.Coff.init(allocator, self_file); var di = DebugInfo{ .coff = coff_obj,