[前][次][番号順一覧][スレッド一覧]

ruby-changes:23702

From: mame <ko1@a...>
Date: Tue, 22 May 2012 00:47:17 +0900 (JST)
Subject: [ruby-changes:23702] mame:r35753 (trunk): * struct.c (rb_struct_members): Refactoring. As Struct#members had

mame	2012-05-22 00:47:03 +0900 (Tue, 22 May 2012)

  New Revision: 35753

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35753

  Log:
    * 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]

  Modified files:
    trunk/ChangeLog
    trunk/struct.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35752)
+++ ChangeLog	(revision 35753)
@@ -1,3 +1,12 @@
+Tue May 22 00:45:05 2012  Yusuke Endoh  <mame@t...>
+
+	* 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@r...>
 
 	* lib/net/ftp.rb (Net::FTP#retrbinary): close only if conn is not nil
Index: struct.c
===================================================================
--- struct.c	(revision 35752)
+++ struct.c	(revision 35753)
@@ -64,18 +64,9 @@
 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);
 }
 
 /*

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]