Skip to content
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

REFACTORING: supporting a list of bytes #685

Merged
merged 1 commit into from May 1, 2013

Conversation

Projects
None yet
2 participants
@josedonizetti
Copy link
Member

josedonizetti commented May 1, 2013

This will help fix the issues with IO.ungetc

@headius

This comment has been minimized.

Copy link
Member

headius commented May 1, 2013

Nice... ungetc has been dragging on for too long. Will review and merge.

@headius

This comment has been minimized.

Copy link
Member

headius commented May 1, 2013

Changes look good, and I'll merge them in. We may want to do our own lighter-weight implementation of the ungot characters buffer, so ungetting a byte doesn't end up creating both a Byte and a LinkedList node.

headius added a commit that referenced this pull request May 1, 2013

Merge pull request #685 from josedonizetti/supporting-more-bytes-ungetc
REFACTORING: supporting a list of bytes

@headius headius merged commit e8ede87 into jruby:master May 1, 2013

1 check failed

default The Travis build failed
Details
@josedonizetti

This comment has been minimized.

Copy link
Member Author

josedonizetti commented May 1, 2013

@headius What I could do is change the code to be lazy, and only creating the linked list when trying to ungetc more than one byte. How that sounds?

@headius

This comment has been minimized.

Copy link
Member

headius commented May 1, 2013

@josedonizetti That's a good start, since most IO users won't ever ungetc. However I was thinking of something more like a byte-based ArrayList where we could simply unget an additional byte by setting a byte[] element and moving an offset.

Heh, as I wrote this it suddenly occurred to me: we have ByteList. So what if we just use a ByteList and ungetc appends a byte into it and removes bytes from it, rather than using LinkedList? I don't think the code would change much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.