summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorJohn Hawthorn <[email protected]>2025-03-10 23:49:59 -0700
committerJohn Hawthorn <[email protected]>2025-04-18 13:03:54 +0900
commit89199a47db25a89cbce05f1be6685e96ded32db5 (patch)
tree0cb26b1ada0963e3f8ddd5148bc94812523b195d /string.c
parent6f6d07272e76682029112c4ceb6eb6b811ee8d6f (diff)
Extract rb_gc_free_fstring to string.c
This allows more flexibility in how we deal with the fstring table
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12921
Diffstat (limited to 'string.c')
-rw-r--r--string.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/string.c b/string.c
index d7ec684d1b..b278188af4 100644
--- a/string.c
+++ b/string.c
@@ -578,6 +578,16 @@ register_fstring(VALUE str, bool copy, bool force_precompute_hash)
return args.fstr;
}
+void rb_gc_free_fstring(VALUE obj) {
+ ASSERT_vm_locking();
+
+ st_data_t fstr = (st_data_t)obj;
+ st_delete(rb_vm_fstring_table(), &fstr, NULL);
+ RB_DEBUG_COUNTER_INC(obj_str_fstr);
+
+ FL_UNSET(obj, RSTRING_FSTR);
+}
+
static VALUE
setup_fake_str(struct RString *fake_str, const char *name, long len, int encidx)
{