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

ruby-changes:32401

From: glass <ko1@a...>
Date: Thu, 2 Jan 2014 00:55:59 +0900 (JST)
Subject: [ruby-changes:32401] glass:r44480 (trunk): * array.c (rb_ary_zip): use ALLOCV_N() instead of ALLOCA_N().

glass	2014-01-02 00:55:51 +0900 (Thu, 02 Jan 2014)

  New Revision: 44480

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

  Log:
    * array.c (rb_ary_zip): use ALLOCV_N() instead of ALLOCA_N().

  Modified files:
    trunk/ChangeLog
    trunk/array.c
Index: array.c
===================================================================
--- array.c	(revision 44479)
+++ array.c	(revision 44480)
@@ -3240,8 +3240,10 @@ rb_ary_zip(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/array.c#L3240
     if (rb_block_given_p()) {
 	int arity = rb_block_arity();
 
-	if (arity > 1 && argc+1 < 0x100) {
-	    VALUE *tmp = ALLOCA_N(VALUE, argc+1);
+	if (arity > 1) {
+	    VALUE work, *tmp;
+
+	    tmp = ALLOCV_N(VALUE, work, argc+1);
 
 	    for (i=0; i<RARRAY_LEN(ary); i++) {
 		tmp[0] = RARRAY_AREF(ary, i);
@@ -3250,6 +3252,8 @@ rb_ary_zip(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/array.c#L3252
 		}
 		rb_yield_values2(argc+1, tmp);
 	    }
+
+	    if (work) ALLOCV_END(work);
 	}
 	else {
 	    for (i=0; i<RARRAY_LEN(ary); i++) {
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44479)
+++ ChangeLog	(revision 44480)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jan  2 00:53:16 2014  Masaki Matsushita  <glass.saga@g...>
+
+	* array.c (rb_ary_zip): use ALLOCV_N() instead of ALLOCA_N().
+
 Thu Jan  2 00:04:29 2014  Masaki Matsushita  <glass.saga@g...>
 
 	* hash.c (rb_hash_keys): make rb_hash_keys() static.

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

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