diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-21 15:47:03 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-21 15:47:03 +0000 |
commit | f9217681c5fd1d9bfc91945c7a32eb2fd76a7c98 (patch) | |
tree | ff95a8a58d04cf09c54c348d3123d83d9ccb2988 /struct.c | |
parent | 2f6c48e53b36397b7ef61fc3194d35aa2b89a1c6 (diff) |
* struct.c (rb_struct_members): Refactoring. As Struct#members had
returned an array of String, the old code was needed to convert
Symbols to Strings. But it is almost unnecessary because the
method now returns an array of Symbols. A patch by Masaki
Matsushita <glass.saga at gmail dot com> [Feature #6218]
[ruby-dev:45451]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'struct.c')
-rw-r--r-- | struct.c | 13 |
1 files changed, 2 insertions, 11 deletions
@@ -64,18 +64,9 @@ rb_struct_members(VALUE s) static VALUE rb_struct_s_members_m(VALUE klass) { - VALUE members, ary; - VALUE *p, *pend; + VALUE members = rb_struct_s_members(klass); - members = rb_struct_s_members(klass); - ary = rb_ary_new2(RARRAY_LEN(members)); - p = RARRAY_PTR(members); pend = p + RARRAY_LEN(members); - while (p < pend) { - rb_ary_push(ary, *p); - p++; - } - - return ary; + return rb_ary_dup(members); } /* |