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

ruby-changes:12642

From: nobu <ko1@a...>
Date: Sun, 2 Aug 2009 20:12:12 +0900 (JST)
Subject: [ruby-changes:12642] Ruby:r24355 (trunk): * array.c (rb_ary_combination, rb_ary_product): prevent from GC.

nobu	2009-08-02 20:09:12 +0900 (Sun, 02 Aug 2009)

  New Revision: 24355

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

  Log:
    * array.c (rb_ary_combination, rb_ary_product): prevent from GC.

  Modified files:
    trunk/ChangeLog
    trunk/array.c

Index: array.c
===================================================================
--- array.c	(revision 24354)
+++ array.c	(revision 24355)
@@ -3748,8 +3748,8 @@
 	for (i = 0; i < n; i++) used[i] = 0; /* initialize array */
 
 	permute0(n, r, p, 0, used, ary0); /* compute and yield permutations */
-	RB_GC_GUARD(t0);
-	RB_GC_GUARD(t1);
+	ary_discard(t0);
+	ary_discard(t1);
 	RBASIC(ary0)->klass = rb_cArray;
     }
     return ary;
@@ -3839,6 +3839,8 @@
 		stack[lev--]++;
 	    } while (lev && (stack[lev+1]+n == len+lev+1));
 	}
+	ary_discard(t0);
+	ary_discard(cc);
     }
     return ary;
 }
@@ -3916,6 +3918,8 @@
 	    counters[m]++;
 	}
     }
+    ary_discard(t0);
+    ary_discard(t1);
 
     return result;
 }
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24354)
+++ ChangeLog	(revision 24355)
@@ -1,3 +1,7 @@
+Sun Aug  2 20:09:07 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* array.c (rb_ary_combination, rb_ary_product): prevent from GC.
+
 Sun Aug  2 16:53:19 2009  Yusuke Endoh  <mame@t...>
 
 	* test/ruby/test_rand.rb: add tests for Random#float's rejection

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

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