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

utf8_to_uv_msgs: Do some code cleanup #22819

Merged
merged 7 commits into from
Jan 16, 2025

Conversation

khwilliamson
Copy link
Contributor

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

  • This set of changes does not require a perldelta entry.

utf8.c Outdated Show resolved Hide resolved
@khwilliamson khwilliamson marked this pull request as draft December 10, 2024 22:52
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 khwilliamson marked this pull request as ready for review January 13, 2025 00:18
@khwilliamson
Copy link
Contributor Author

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

@khwilliamson khwilliamson merged commit 8542129 into Perl:blead Jan 16, 2025
33 checks passed
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