-
Notifications
You must be signed in to change notification settings - Fork 26
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 StringIO#pread #56
Conversation
ext/stringio/stringio.c
Outdated
long offset = NUM2LONG(rb_offset); | ||
|
||
if (len < 0) { | ||
rb_raise(rb_eArgError, "negative string size (or size too big)"); |
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.
Could you add rb_len
to error message?
ext/stringio/stringio.c
Outdated
} | ||
|
||
if (offset < 0) { | ||
rb_exc_raise(rb_syserr_new(EINVAL, "pread: Invalid offset argument")); |
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.
Could you add rb_offset
to error message?
@kou I applied your suggestions. |
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.
We need a review for JRuby part from @headius before we merge this.
Both for being closer to real IOs and also because it's a convenient API in multithreaded scenarios.
@kou done.
No problem. Note that there are pre-existing failures on the JRuby suite, but the added test does pass on JRuby. |
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.
JRuby part looks fine. I can do a small optimization (split out separate arities) once this is merged.
OK. |
Both for being closer to real IOs and also because it's a convenient API in multithreaded scenarios.
cc @kddnewton @nobu