-
Notifications
You must be signed in to change notification settings - Fork 560
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
utf8_to_uv_msgs: Do some code cleanup #22819
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
khwilliamson
force-pushed
the
utf8_to_uv_msgs
branch
from
December 4, 2024 19:19
23ee4f2
to
f88c1ea
Compare
tonycoz
reviewed
Dec 10, 2024
This only is needed if a problem was found.
There are several paths through the code that don't need this copy to be made. Move to just before it is really needed.
By deferring to the end of the function the setting of a variable returned to the caller, we can eliminate one copy of that setting. The early returns from this function that necessitated the early setting have been removed in previous commits.
This makes these two variables always contain the value their names indicate.
This is a small detail, but this moves this assert to after a conditional that would exclude it. That is, if the conditional is true, the assert is pointless. So move the assert to where we know the conditional is false.
C99 allows us to declare anywhere; so move these to where its more logical. It also makes sure some variables are initialized before the goto that jumps to the end of the program, and which currently doesn't rely on these values, but could be changed to do so someday without the coder realizing it. This prevents a problem in case that happens.
This was introduced in a rebasing error
khwilliamson
force-pushed
the
utf8_to_uv_msgs
branch
from
January 13, 2025 00:17
f88c1ea
to
56b1fa0
Compare
I should have fixed this up long before now. Some of the commits in the original PR still aren't ready yet, but others were and fixed compiler warnings that others ended up spending duplicate effort in fixing |
tonycoz
approved these changes
Jan 16, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This should not change behavior.
It moves declarations and initializations closer to first use. The biggest change is that several cases in a switch have virtually identical logic, which this extracts out into common code