-
Notifications
You must be signed in to change notification settings - Fork 141
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
Replace fdopen by conversion to CFILE #52
Conversation
Perhaps surprisingly, I'm a little reluctant to do this. I want to keep supporting release 0.2, and as you noticed |
Ah, I didn't know |
Rats, it looks like I deleted the definition of |
Shall I close this pull request then? |
OK, it should be in |
Yup, that works thanks. But you should use the systemerror functions for C calls which set errno on failure. You can change it now, or I can make a pull-request sometime later, as I set out to fix it through julia and the julia-libs I use. |
Thanks for the tip! You mean just changing the last line of |
I mean - if FILEp == 0
- error("fdopen failed")
- end
+ systemerror("fdopen failed", FILEp == 0) and either - ccall(:fseek, Cint, (Ptr{Void}, Clong, Cint),
- FILEp, convert(Clong, offset), int32(0)) == 0 ||
- error("fseek failed")
+ systemerror("fseek failed", ccall(:fseek, Cint, (Ptr{Void}, Clong, Cint), FILEp, convert(Clong, offset), int32(0)) == 0) or - ccall(:fseek, Cint, (Ptr{Void}, Clong, Cint),
- FILEp, convert(Clong, offset), int32(0)) == 0 ||
- error("fseek failed")
+ status = ccall(:fseek, Cint, (Ptr{Void}, Clong, Cint), FILEp, convert(Clong, offset), int32(0))
+ systemerror("fseek failed", status == 0) |
Ah, right. (I had mentally moved on to your other issue.) I'll be happy to do this, if you prefer, though obviously this was rather close to a PR already! |
So it works with your recent commit to julia-lang :)