use * for pointer type instead of &
See #770 To help automatically translate code, see the zig-fmt-pointer-reform-2 branch. This will convert all & into *. Due to the syntax ambiguity (which is why we are making this change), even address-of & will turn into *, so you'll have to manually fix thes instances. You will be guaranteed to get compile errors for them - expected 'type', found 'foo'
This commit is contained in:
18
std/elf.zig
18
std/elf.zig
@@ -338,7 +338,7 @@ pub const SectionHeader = struct {
|
||||
};
|
||||
|
||||
pub const Elf = struct {
|
||||
in_file: &os.File,
|
||||
in_file: *os.File,
|
||||
auto_close_stream: bool,
|
||||
is_64: bool,
|
||||
endian: builtin.Endian,
|
||||
@@ -348,20 +348,20 @@ pub const Elf = struct {
|
||||
program_header_offset: u64,
|
||||
section_header_offset: u64,
|
||||
string_section_index: u64,
|
||||
string_section: &SectionHeader,
|
||||
string_section: *SectionHeader,
|
||||
section_headers: []SectionHeader,
|
||||
allocator: &mem.Allocator,
|
||||
allocator: *mem.Allocator,
|
||||
prealloc_file: os.File,
|
||||
|
||||
/// Call close when done.
|
||||
pub fn openPath(elf: &Elf, allocator: &mem.Allocator, path: []const u8) !void {
|
||||
pub fn openPath(elf: *Elf, allocator: *mem.Allocator, path: []const u8) !void {
|
||||
try elf.prealloc_file.open(path);
|
||||
try elf.openFile(allocator, &elf.prealloc_file);
|
||||
try elf.openFile(allocator, *elf.prealloc_file);
|
||||
elf.auto_close_stream = true;
|
||||
}
|
||||
|
||||
/// Call close when done.
|
||||
pub fn openFile(elf: &Elf, allocator: &mem.Allocator, file: &os.File) !void {
|
||||
pub fn openFile(elf: *Elf, allocator: *mem.Allocator, file: *os.File) !void {
|
||||
elf.allocator = allocator;
|
||||
elf.in_file = file;
|
||||
elf.auto_close_stream = false;
|
||||
@@ -503,13 +503,13 @@ pub const Elf = struct {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn close(elf: &Elf) void {
|
||||
pub fn close(elf: *Elf) void {
|
||||
elf.allocator.free(elf.section_headers);
|
||||
|
||||
if (elf.auto_close_stream) elf.in_file.close();
|
||||
}
|
||||
|
||||
pub fn findSection(elf: &Elf, name: []const u8) !?&SectionHeader {
|
||||
pub fn findSection(elf: *Elf, name: []const u8) !?*SectionHeader {
|
||||
var file_stream = io.FileInStream.init(elf.in_file);
|
||||
const in = &file_stream.stream;
|
||||
|
||||
@@ -533,7 +533,7 @@ pub const Elf = struct {
|
||||
return null;
|
||||
}
|
||||
|
||||
pub fn seekToSection(elf: &Elf, elf_section: &SectionHeader) !void {
|
||||
pub fn seekToSection(elf: *Elf, elf_section: *SectionHeader) !void {
|
||||
try elf.in_file.seekTo(elf_section.offset);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user