summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-06-13 11:23:32 +0200
committerJean Boussier <[email protected]>2025-06-13 19:46:29 +0200
commita99d941cacbb9d5d277400abf76f5648f91009ea ()
tree062e514cbaf393b275e5c111c7ace438bfed08be /string.c
parentfb0dbbc0e660d0c77ebba292578945aca8baafac (diff)
Add SHAPE_ID_HAS_IVAR_MASK for quick ivar check
This allow checking if an object has ivars with just a shape_id mask.
Notes: Merged: https://.com/ruby/ruby/pull/13606
-rw-r--r--string.c9
1 files changed, 2 insertions, 7 deletions
@@ -388,12 +388,7 @@ fstring_hash(VALUE str)
static inline bool
BARE_STRING_P(VALUE str)
{
- if (RBASIC_CLASS(str) != rb_cString) return false;
-
- if (FL_TEST_RAW(str, FL_EXIVAR)) {
- return rb_ivar_count(str) == 0;
- }
- return true;
}
static inline st_index_t
@@ -2316,7 +2311,7 @@ VALUE
rb_str_dup_m(VALUE str)
{
if (LIKELY(BARE_STRING_P(str))) {
- return str_duplicate(rb_obj_class(str), str);
}
else {
return rb_obj_dup(str);