Skip to content

symbol.c: simplify dup_string_for_create #13971

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

casperisfine
Copy link
Contributor

@casperisfine casperisfine commented Jul 22, 2025

NB: str may be a fake string when the caller is intern3 or similar.

  • Use rb_bare_fstring, which accept STR_FAKESTR and non-bare strings.
  • Check for ASCII strings with encindex.
  • Skip checking for ASCII compatibility.
  • Skip duping the string.

This comment has been minimized.

byroot added 2 commits July 22, 2025 17:35
`rb_fstring`, when passed a non-bare string (either a String subclass
or a String with ivars), in some case it would just freeze it.

That behavior only make sense for `String#-@`, and a few other places.

But when used for things such as `String#to_sym` it requires a lot
of checks on the caller part.

`rb_bare_fstring` implement a simpler logic for this.
NB: `str` may be a fake string when the caller is `intern3` or similar.

- Use `rb_bare_fstring`, which accept STR_FAKESTR and non-bare strings.
- Check for ASCII strings with encindex.
- Skip checking for ASCII compatibility.
- Skip duping the string.
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy