Skip to content

Commit

Permalink
[Feature #20265] Remove rb_newobj_of and RB_NEWOBJ_OF
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzhu2118 authored and eregon committed Mar 14, 2024
1 parent cf99ee2 commit 89175b2
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions optional/capi/ext/object_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,8 @@ static VALUE object_spec_rb_ivar_foreach(VALUE self, VALUE obj) {
}

static VALUE speced_allocator(VALUE klass) {
VALUE flags = 0;
VALUE instance;
if (RTEST(rb_class_inherited_p(klass, rb_cString))) {
flags = T_STRING;
} else if (RTEST(rb_class_inherited_p(klass, rb_cArray))) {
flags = T_ARRAY;
} else {
flags = T_OBJECT;
}
instance = rb_newobj_of(klass, flags);
VALUE super = rb_class_get_superclass(klass);
VALUE instance = rb_get_alloc_func(super)(klass);
rb_iv_set(instance, "@from_custom_allocator", Qtrue);
return instance;
}
Expand Down

0 comments on commit 89175b2

Please sign in to comment.