| ... | @@ -371,21 +371,21 @@ pub const Elf = struct { | ... | @@ -371,21 +371,21 @@ pub const Elf = struct { |
| 371 | prealloc_file: File, | 371 | prealloc_file: File, |
| 372 | | 372 | |
| 373 | /// Call close when done. | 373 | /// Call close when done. |
| 374 | pub fn openPath(elf: *Elf, allocator: *mem.Allocator, path: []const u8) !void { | 374 | pub fn openPath(allocator: *mem.Allocator, path: []const u8) !Elf { |
| 375 | @compileError("TODO implement"); | 375 | @compileError("TODO implement"); |
| 376 | } | 376 | } |
| 377 | | 377 | |
| 378 | /// Call close when done. | 378 | /// Call close when done. |
| 379 | pub fn openFile(elf: *Elf, allocator: *mem.Allocator, file: File) !void { | 379 | pub fn openFile(allocator: *mem.Allocator, file: File) !Elf { |
| 380 | @compileError("TODO implement"); | 380 | @compileError("TODO implement"); |
| 381 | } | 381 | } |
| 382 | | 382 | |
| 383 | pub fn openStream( | 383 | pub fn openStream( |
| 384 | elf: *Elf, | | |
| 385 | allocator: *mem.Allocator, | 384 | allocator: *mem.Allocator, |
| 386 | seekable_stream: *io.SeekableStream(anyerror, anyerror), | 385 | seekable_stream: *io.SeekableStream(anyerror, anyerror), |
| 387 | in: *io.InStream(anyerror), | 386 | in: *io.InStream(anyerror), |
| 388 | ) !void { | 387 | ) !Elf { |
| | 388 | var elf: Elf = undefined; |
| 389 | elf.auto_close_stream = false; | 389 | elf.auto_close_stream = false; |
| 390 | elf.allocator = allocator; | 390 | elf.allocator = allocator; |
| 391 | elf.seekable_stream = seekable_stream; | 391 | elf.seekable_stream = seekable_stream; |
| ... | @@ -523,6 +523,8 @@ pub const Elf = struct { | ... | @@ -523,6 +523,8 @@ pub const Elf = struct { |
| 523 | // not a string table | 523 | // not a string table |
| 524 | return error.InvalidFormat; | 524 | return error.InvalidFormat; |
| 525 | } | 525 | } |
| | 526 | |
| | 527 | return elf; |
| 526 | } | 528 | } |
| 527 | | 529 | |
| 528 | pub fn close(elf: *Elf) void { | 530 | pub fn close(elf: *Elf) void { |