Skip to content

Simplify CFString's Get MaximumSizeForEncoding so its program flow is clearer #2550

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

Merged
merged 1 commit into from Nov 1, 2019
Merged

Conversation

ghost
Copy link

@ghost ghost commented Oct 30, 2019

CFString's Get MaximumSizeForEncoding method is not clear in that the else branch ALWAYS following the rest of the method due to early returns.

Because the two top branches always return, I removed the else statement, and put encoding & 0xFFF in the switch statement itself instead of modifying the encoding directly.

…he rest of the method due to early returns. Because the two top branches always return, I removed the else statement, and put encoding & 0xFFF in the switch statement itself instead of modifying the encoding directly.
@ghost
Copy link
Author

ghost commented Oct 30, 2019

I tested this program with the test suite, static analyzers, and even accounted for the things that haven't been used for years.

There are no regressions

@parkera
Copy link
Contributor

parkera commented Nov 1, 2019

@swift-ci test

@parkera parkera merged commit facf571 into swiftlang:master Nov 1, 2019
@parkera
Copy link
Contributor

parkera commented Nov 1, 2019

Thank you!

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.

1 participant