Skip to content

Remove need for reallocations for MacOS implementation#37

Closed
Kijewski wants to merge 1 commit intostrawlab:mainfrom
Kijewski:pr-less-realloc-mac
Closed

Remove need for reallocations for MacOS implementation#37
Kijewski wants to merge 1 commit intostrawlab:mainfrom
Kijewski:pr-less-realloc-mac

Conversation

@Kijewski
Copy link
Copy Markdown
Collaborator

No description provided.

~/.cargo/git/db/
target/
- run: cargo test --workspace --all-targets
- run: cargo run --example get_timezone
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't know how to change the timezone of the runner, so don't know if there is a better option than to at the result whether it looks sane.

Comment thread src/tz_macos.rs
Comment on lines +8 to +9
str1.truncate(match str1.split_ascii_whitespace().next() {
Some(s) => s.len(),
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I put the truncation outside of the match. Inside the Some() arm, the string is still borrowed. Cf. rust-lang/rust#59159

@astraw
Copy link
Copy Markdown
Member

astraw commented Apr 15, 2022

I had a look at this myself and discovered the core_foundation::timezone::CFTimeZone::name() method which solves the problem more elegantly I think. So this is superseded by 9acb233.

Thanks for prompting me to look into this.

Recent changes released as 0.1.33.

@astraw astraw closed this Apr 15, 2022
@Kijewski Kijewski deleted the pr-less-realloc-mac branch April 15, 2022 19:50
@Kijewski
Copy link
Copy Markdown
Collaborator Author

Nice, that much prettier!

@lopopolo lopopolo added the Tier-1 Rust Tier-1 platform label Oct 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tier-1 Rust Tier-1 platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants