ruby-changes:52706
From: ko1 <ko1@a...>
Date: Fri, 5 Oct 2018 08:33:09 +0900 (JST)
Subject: [ruby-changes:52706] ko1:r64917 (trunk): use RARRAY_AREF().
ko1 2018-10-05 08:33:03 +0900 (Fri, 05 Oct 2018) New Revision: 64917 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64917 Log: use RARRAY_AREF(). * struct.c (setup_struct): no need to use Array raw ptr here. Modified files: trunk/struct.c Index: struct.c =================================================================== --- struct.c (revision 64916) +++ struct.c (revision 64917) @@ -313,7 +313,6 @@ rb_struct_s_inspect(VALUE klass) https://github.com/ruby/ruby/blob/trunk/struct.c#L313 static VALUE setup_struct(VALUE nstr, VALUE members) { - const VALUE *ptr_members; long i, len; members = struct_set_members(nstr, members); @@ -323,17 +322,17 @@ setup_struct(VALUE nstr, VALUE members) https://github.com/ruby/ruby/blob/trunk/struct.c#L322 rb_define_singleton_method(nstr, "[]", rb_class_new_instance, -1); rb_define_singleton_method(nstr, "members", rb_struct_s_members_m, 0); rb_define_singleton_method(nstr, "inspect", rb_struct_s_inspect, 0); - ptr_members = RARRAY_CONST_PTR(members); len = RARRAY_LEN(members); for (i=0; i< len; i++) { - ID id = SYM2ID(ptr_members[i]); + VALUE sym = RARRAY_AREF(members, i); + ID id = SYM2ID(sym); VALUE off = LONG2NUM(i); if (i < N_REF_FUNC) { rb_define_method_id(nstr, id, ref_func[i], 0); } else { - define_aref_method(nstr, ptr_members[i], off); + define_aref_method(nstr, sym, off); } define_aset_method(nstr, ID2SYM(rb_id_attrset(id)), off); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/