Skip to content

Commit

Permalink
Merge pull request #33 from mrkn/stop_newobj_of
Browse files Browse the repository at this point in the history
Stop using NEWOBJ_OF
  • Loading branch information
mrkn authored May 13, 2024
2 parents 7a58cd7 + 9b38c07 commit 507e750
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext/enumerable/statistics/extension/statistics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 507e750

Please sign in to comment.