From c8c99b88a4692687559066daa753c3e06e7c2ad0 Mon Sep 17 00:00:00 2001 From: Kenta Murata Date: Tue, 14 May 2024 01:31:50 +0900 Subject: [PATCH] Stop using NEWOBJ_OF --- ext/enumerable/statistics/extension/statistics.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/enumerable/statistics/extension/statistics.c b/ext/enumerable/statistics/extension/statistics.c index bbc3d10..0c0a675 100644 --- a/ext/enumerable/statistics/extension/statistics.c +++ b/ext/enumerable/statistics/extension/statistics.c @@ -138,7 +138,7 @@ complex_new(VALUE klass, VALUE real, VALUE imag) { assert(!RB_TYPE_P(real, T_COMPLEX)); - NEWOBJ_OF(obj, struct RComplex, klass, T_COMPLEX | (RGENGC_WB_PROTECTED_COMPLEX ? FL_WB_PROTECTED : 0)); + VALUE obj = rb_get_alloc_func(klass)(klass); RCOMPLEX_SET_REAL(obj, real); RCOMPLEX_SET_IMAG(obj, imag); @@ -538,9 +538,11 @@ f_gcd(VALUE x, VALUE y) inline static VALUE nurat_s_new_internal(VALUE klass, VALUE num, VALUE den) { - NEWOBJ_OF(obj, struct RRational, klass, T_RATIONAL | (RGENGC_WB_PROTECTED_RATIONAL ? FL_WB_PROTECTED : 0)); + VALUE obj = rb_get_alloc_func(klass)(klass); + RRATIONAL_SET_NUM(obj, num); RRATIONAL_SET_DEN(obj, den); + return (VALUE)obj; }