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

Storable: use utf8_to_bytes_overwrite() if available #22956

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from

Conversation

khwilliamson
Copy link
Contributor

This is simpler and saves a malloc each time.

Note that this code could use plain utf8_to_bytes() on older perls, but it is less convenient, so would require more code; I don't think the performance gain is worth it.

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

This is simpler and saves a malloc each time.

Note that this code could use plain utf8_to_bytes() on older perls, but
it is less convenient, so would require more code; I don't think the
performance gain is worth it.

/* If we are able to downgrade here; that means that we have a
* key which only had chars 0-255, but was utf8 encoded. */
if (utf8_to_bytes_overwrite( (U8**) &keyval, &keylen_tmp)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I was a bit worried about this, since this modifies the PV belonging to a SV, but the SV is a copy of the key from the hash on this branch, so it's safe.

It does make a UTF-8 SV with a validly encoded PV into a UTF-8 SV with a probably invalidly encoded PV, but that SV is almost immediately discarded.

Will the new utf8_to_bytes_* functions be added to ppport.h?

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