aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-21 15:47:03 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-21 15:47:03 +0000
commitf9217681c5fd1d9bfc91945c7a32eb2fd76a7c98 (patch)
treeff95a8a58d04cf09c54c348d3123d83d9ccb2988
parent2f6c48e53b36397b7ef61fc3194d35aa2b89a1c6 (diff)
downloadruby-f9217681c5fd1d9bfc91945c7a32eb2fd76a7c98.tar.gz
* 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
-rw-r--r--ChangeLog9
-rw-r--r--struct.c13
2 files changed, 11 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c12706ac5..67885d97c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/struct.c b/struct.c
index e958a78df8..8168f62bb1 100644
--- a/struct.c
+++ b/struct.c
@@ -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);
}
/*