Permalink
Browse files

* 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
  • Loading branch information...
1 parent 2f6c48e commit f9217681c5fd1d9bfc91945c7a32eb2fd76a7c98 @mame mame committed May 21, 2012
Showing with 11 additions and 11 deletions.
  1. +9 −0 ChangeLog
  2. +2 −11 struct.c
View
@@ -1,3 +1,12 @@
+Tue May 22 00:45:05 2012 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * 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]
+
Mon May 21 19:20:25 2012 NARUSE, Yui <naruse@ruby-lang.org>
* lib/net/ftp.rb (Net::FTP#retrbinary): close only if conn is not nil
View
@@ -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);
}
/*

0 comments on commit f921768

Please sign in to comment.