authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-08-20 09:14:37+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-08-20 09:14:37+02:00
logad79b80524820d3f0ec60d4d21461208227cd4c8
treea1fc4070f2a06bcfe665f93ae094f99166a674c9
parent9164daaa39a0ebffcfff27d6d8c91f5857bdfe04
signature Signed by PGP key 4AEE18F83AFDEB23

Apply suggestions from code review

Co-authored-by: Andrew Kelley <andrew@ziglang.org>

1 files changed, 3 insertions(+), 4 deletions(-)

src-self-hosted/link/MachO.zig+3-4
...@@ -23,7 +23,7 @@ segment_cmds: std.ArrayListUnmanaged(macho.segment_command_64) = std.ArrayListUn...@@ -23,7 +23,7 @@ segment_cmds: std.ArrayListUnmanaged(macho.segment_command_64) = std.ArrayListUn
2323
24/// Stored in native-endian format, depending on target endianness needs to be bswapped on read/write.24/// Stored in native-endian format, depending on target endianness needs to be bswapped on read/write.
25/// Same order as in the file.25/// Same order as in the file.
26sections: std.ArrayListUnmanaged(macho.@"section_64") = std.ArrayListUnmanaged(macho.@"section_64"){},26sections: std.ArrayListUnmanaged(macho.section_64) = std.ArrayListUnmanaged(macho.section_64){},
2727
28entry_addr: ?u64 = null,28entry_addr: ?u64 = null,
2929
...@@ -117,9 +117,8 @@ fn createFile(allocator: *Allocator, file: fs.File, options: link.Options) !Mach...@@ -117,9 +117,8 @@ fn createFile(allocator: *Allocator, file: fs.File, options: link.Options) !Mach
117}117}
118118
119fn makeString(self: *MachO, comptime bytes: []const u8) [16]u8 {119fn makeString(self: *MachO, comptime bytes: []const u8) [16]u8 {
120 if (bytes.len > 16) @compileError("MachO segment/section name too long");
121
122 var buf: [16]u8 = undefined;120 var buf: [16]u8 = undefined;
121 if (bytes.len > buf.len) @compileError("MachO segment/section name too long");
123 mem.copy(u8, buf[0..], bytes);122 mem.copy(u8, buf[0..], bytes);
124 return buf;123 return buf;
125}124}
...@@ -194,7 +193,7 @@ pub fn flush(self: *MachO, module: *Module) !void {...@@ -194,7 +193,7 @@ pub fn flush(self: *MachO, module: *Module) !void {
194193
195pub fn deinit(self: *MachO) void {194pub fn deinit(self: *MachO) void {
196 self.segment_cmds.deinit(self.base.allocator);195 self.segment_cmds.deinit(self.base.allocator);
197 self.@"sections".deinit(self.base.allocator);196 self.sections.deinit(self.base.allocator);
198}197}
199198
200pub fn allocateDeclIndexes(self: *MachO, decl: *Module.Decl) !void {}199pub fn allocateDeclIndexes(self: *MachO, decl: *Module.Decl) !void {}