aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-28 08:51:41 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-28 08:51:41 +0000
commit11cef3cca3cf1a068fa2df166ffdfb7d604bc794 (patch)
tree55117edf48a8df083f202ffaddde72fe6801f467
parent97b1c9edd2993d08370e89e4977e00cb25778cbd (diff)
downloadruby-11cef3cca3cf1a068fa2df166ffdfb7d604bc794.tar.gz
* array.c (rb_ary_product): Use tmpary instead, to ensure marking
arrays by GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--array.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b9a6b6a9e3..7ddc2ce31d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri May 28 17:34:48 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * array.c (rb_ary_product): Use tmpary instead, to ensure marking
+ arrays by GC.
+
Fri May 28 11:40:07 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
* array.c (rb_ary_product): Do not rely on GC, t0 should be
diff --git a/array.c b/array.c
index 146b03b137..467a50ea76 100644
--- a/array.c
+++ b/array.c
@@ -4294,9 +4294,9 @@ static VALUE
rb_ary_product(int argc, VALUE *argv, VALUE ary)
{
int n = argc+1; /* How many arrays we're operating on */
- volatile VALUE t0 = tmpbuf(n, sizeof(VALUE));
+ volatile VALUE t0 = tmpary(n);
volatile VALUE t1 = tmpbuf(n, sizeof(int));
- VALUE *arrays = (VALUE*)RSTRING_PTR(t0); /* The arrays we're computing the product of */
+ VALUE *arrays = RARRAY_PTR(t0); /* The arrays we're computing the product of */
int *counters = (int*)RSTRING_PTR(t1); /* The current position in each one */
VALUE result = Qnil; /* The array we'll be returning, when no block given */
long i,j;
@@ -4372,7 +4372,7 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary)
}
}
done:
- tmpbuf_discard(t0);
+ tmpary_discard(t0);
tmpbuf_discard(t1);
return NIL_P(result) ? ary : result;