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

ruby-changes:42852

From: nobu <ko1@a...>
Date: Fri, 6 May 2016 14:33:17 +0900 (JST)
Subject: [ruby-changes:42852] nobu:r54926 (trunk): random.c: return value is not GCed

nobu	2016-05-06 15:29:55 +0900 (Fri, 06 May 2016)

  New Revision: 54926

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54926

  Log:
    random.c: return value is not GCed
    
    * random.c (rand_init): since seed is the return value, no needs
      to be volatile to prevent from GC.

  Modified files:
    trunk/random.c
Index: random.c
===================================================================
--- random.c	(revision 54925)
+++ random.c	(revision 54926)
@@ -380,14 +380,13 @@ random_alloc(VALUE klass) https://github.com/ruby/ruby/blob/trunk/random.c#L380
 }
 
 static VALUE
-rand_init(struct MT *mt, VALUE vseed)
+rand_init(struct MT *mt, VALUE seed)
 {
-    volatile VALUE seed;
     uint32_t buf0[SIZEOF_LONG / SIZEOF_INT32 * 4], *buf = buf0;
     size_t len;
     int sign;
 
-    seed = rb_to_int(vseed);
+    seed = rb_to_int(seed);
 
     len = rb_absint_numwords(seed, 32, NULL);
     if (len > numberof(buf0))

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

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