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

uniq: non-UTF-8 file names and fewer copies #4911

Merged
merged 1 commit into from
May 29, 2023

Conversation

jeddenlea
Copy link
Contributor

@jeddenlea jeddenlea commented May 29, 2023

uniq ought to be able to work with files whose names are not UTF-8.

I've also taken the chance to remove some unnecessary String allocations.

Additionally, both open_input_file and open_output_file were returning items with two implied levels of Box<dyn ...> that were not necessary.

In the case of stdin as input, it was not necessary to wrap stdin with a BufReader, StdinLock implements BufRead itself.

uniq ought to be able to work with files whose names are not UTF-8.

I've also taken the chance to remove some unnecessary String
allocations.

Additionally, both open_input_file and open_output_file were returning
items with two implie levels of `Box<dyn ...>` that were not necessary.

In the case of stdin as input, it was not necessary to wrap stdin with a
BufReader, StdinLock implements BufRead itself.
Copy link
Member

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

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

Looks good! I think we should probably make some helper for this in uucore. Though that should maybe be implemented with an enum instead like in dd:

enum Source {

Could be an interesting thing to look into next if you want :)

@tertsdiepraam tertsdiepraam merged commit f89182e into uutils:main May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants