From 23a48d8fe683df289736e2d90c86006eb919b40d Mon Sep 17 00:00:00 2001 From: eileencodes Date: Wed, 10 Mar 2021 10:24:28 -0500 Subject: 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`. --- class.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'class.c') 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); } } -- cgit v1.2.3