-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
Implement fmemopen
#875
Implement fmemopen
#875
Conversation
3fa3ad1
to
d52b068
Compare
53deb63
to
a9d514e
Compare
eb42301
to
fea5525
Compare
The failing assert will not be done on glibc due to (incorrectly) failing there. NetBSD's libc tests also guard against this in the same way. My implementation is adhering to POSIX, and thus correct; musl and the BSDs agree with me here. This should be ready for review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't taken a good look at this yet, will do later, but just a nitpick already when skimming it over: the comments aren't in the same style :) In general we follow that comments should // Look like this.
, if you could fix that in the relevant places that would be really nice.
Fixed the comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I'm not a fan of this code. It seems that the _allowResizing
flag was used to cram two different classes into one implementation, which makes for a very confusing read of the code. In this case it would be appropriate to have two different classes, and possibly a common superclass that abstracts some of the common behaviour away. Right now (what should be) virtual calls are emulated using the _allowResizing
flag.
In summary, please add missing test cases, since there were several untested cases I've noticed. And separate the two different implementations using inheritance, this will clean up the implementation and hopefully reduce the likelihood of bugs.
5b70b30
to
c7f343a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like io_seek()
and io_read()
can be fully abstracted by just making _buffer_size()
a protected virtual function in the base class. io_write
is unfortunately a little bit trickier it seems since there is a special case for fmemopen()
.
87939fa
to
0691bc1
Compare
154d4cf
to
9e33902
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Supersedes #540.
Fixes #527.