summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2021-03-10 10:24:28 -0500
committerAaron Patterson <aaron.patterson@gmail.com>2021-03-10 09:39:18 -0800
commit23a48d8fe683df289736e2d90c86006eb919b40d (patch)
treecf955554a13a3bf0564f57445302455a02dec59a /class.c
parent9cdb5a51532c99230c2303912a13b9f752f1e775 (diff)
Refactor `rb_class_ivar_set`
In every caller of `rb_class_ivar_set` it checks for the `RCLASS_IV_TBL` and then creates it if it doesn't exist. Instead of repeating this in every caller, this can be done once in `rb_class_ivar_set`.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4254
Diffstat (limited to 'class.c')
-rw-r--r--class.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/class.c b/class.c
index 68cfbfb257..b2e15c20d5 100644
--- a/class.c
+++ b/class.c
@@ -529,9 +529,6 @@ void
rb_singleton_class_attached(VALUE klass, VALUE obj)
{
if (FL_TEST(klass, FL_SINGLETON)) {
- if (!RCLASS_IV_TBL(klass)) {
- RCLASS_IV_TBL(klass) = st_init_numtable();
- }
rb_class_ivar_set(klass, id_attached, obj);
}
}