-
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
do_print: Use new utf8_to_bytes_temp_pv() #22812
Open
khwilliamson
wants to merge
2
commits into
Perl:blead
Choose a base branch
from
khwilliamson:do_io
base: blead
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
Contributor
khwilliamson
commented
Dec 3, 2024
- This set of changes does not require a perldelta entry.
khwilliamson
changed the title
do_print: Use new utfj8_to_bytes_temp_pv()
do_print: Use new utf8_to_bytes_temp_pv()
Dec 3, 2024
tonycoz
reviewed
Dec 4, 2024
tonycoz
reviewed
Dec 4, 2024
tonycoz
reviewed
Jan 8, 2025
tonycoz
reviewed
Jan 8, 2025
tonycoz
reviewed
Jan 8, 2025
doio.c
Outdated
@@ -2259,7 +2260,7 @@ Perl_do_print(pTHX_ SV *sv, PerlIO *fp) | |||
* but only until the system hard limit/the filesystem limit, | |||
* at which we would get EPERM. Note that when using buffered | |||
* io the write failure can be delayed until the flush/close. --jhi */ | |||
if (len && (PerlIO_write(fp,tmps,len) == 0)) | |||
if (len && (PerlIO_write(fp,(char *) tmps,len) == 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PerlIO_write() takes a const void *
for the buffer, you don't need the cast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still the case, no cast is required
tonycoz
reviewed
Jan 8, 2025
khwilliamson
added a commit
to khwilliamson/perl5
that referenced
this pull request
Jan 12, 2025
Two new functions were recently added that have a *free_me parameter. As Tony Cook pointed out in Perl#22812, these would better have been void* instead of U8*. This commit changes to use void* One function in pp.c was using this parameter as a U8* and using its contents. But this need goes away with the new bytes_to_utf8_free_me() function, which eliminates the kludge pp.c used to make sure the new memory got freed.
This removes 6 casts and adds 2, resulting in cleaner looking code.
These new functions do the work this used to duplicate, except they allocate memory only if necessary, instead of always, as previously
khwilliamson
added a commit
to khwilliamson/perl5
that referenced
this pull request
Jan 21, 2025
Two new functions were recently added that have a *free_me parameter. As Tony Cook pointed out in Perl#22812, these would better have been void* instead of U8*. This commit changes to use void* One function in pp.c was using this parameter as a U8* and using its contents. But this need goes away with the new bytes_to_utf8_free_me() function, which eliminates the kludge pp.c used to make sure the new memory got freed.
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.