Skip to content

Implementation for Elf.openFile and Elf.openPath #3163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

n1tram1
Copy link

@n1tram1 n1tram1 commented Sep 3, 2019

I added the optional in_file field to the Elf struct for when the struct is the one that opened/owns the file.
Then when calling Elf.close, if in_file is not null, it means the file is ours and we need to close it.

I checked with valgrind, no files left open (except stdin, stdio, stderr obviously).

The only issue I found is that you can't print the Elf struct anymore because of the file, see #2584 .

}

/// Call close when done.
pub fn openFile(allocator: *mem.Allocator, file: File) !Elf {
@compileError("TODO implement");
var _seekstream = &file.seekableStream().stream;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When openFile returns, this becomes a dangling reference.

@andrewrk andrewrk added this to the 0.6.0 milestone Sep 3, 2019
@daurnimator daurnimator added the standard library This issue involves writing Zig code for the standard library. label Sep 7, 2019
@andrewrk andrewrk removed this from the 0.6.0 milestone Oct 1, 2019
@andrewrk
Copy link
Member

Review feedback unaddressed for 2 months. Please feel free to open a new pull request when you are ready for more review.

@andrewrk andrewrk closed this Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants