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

ruby-changes:2121

From: ko1@a...
Date: 4 Oct 2007 15:51:43 +0900
Subject: [ruby-changes:2121] matz - Ruby:r13612 (trunk): * array.c (rb_ary_permutation): remove C99 dependency.

matz	2007-10-04 15:51:17 +0900 (Thu, 04 Oct 2007)

  New Revision: 13612

  Modified files:
    trunk/ChangeLog
    trunk/array.c
    trunk/version.h

  Log:
    * array.c (rb_ary_permutation): remove C99 dependency.
      [ruby-dev:31934]
    
    * array.c (rb_ary_product): ditto.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/version.h?r1=13612&r2=13611
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/array.c?r1=13612&r2=13611
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13612&r2=13611

Index: array.c
===================================================================
--- array.c	(revision 13611)
+++ array.c	(revision 13612)
@@ -3019,10 +3019,11 @@
 static VALUE
 rb_ary_permutation(VALUE ary, VALUE num)
 {
+    long r, n, i;
+
     RETURN_ENUMERATOR(ary, 1, &num);  /* Return enumerator if no block */
-    long r = NUM2LONG(num);           /* Permutation size from argument */
-    long n = RARRAY_LEN(ary);         /* Array length */
-    long i;
+    r = NUM2LONG(num);                /* Permutation size from argument */
+    n = RARRAY_LEN(ary);              /* Array length */
 
     if (r < 0 || n < r) { 
 	/* no permutations: yield nothing */
@@ -3151,8 +3152,10 @@
 rb_ary_product(int argc, VALUE *argv, VALUE ary)
 {
     int n = argc+1;    /* How many arrays we're operating on */
-    VALUE arrays[n];   /* The arrays we're computing the product of */
-    int counters[n];   /* The current position in each one */
+    volatile VALUE t0 = rb_str_new(0, n*sizeof(VALUE));
+    volatile VALUE t1 = rb_str_new(0, n*sizeof(int));
+    VALUE *arrays = (VALUE*)RSTRING_PTR(t0); /* The arrays we're computing the product of */
+    int *counters = (int*)RSTRING_PTR(t1); /* The current position in each one */
     VALUE result;      /* The array we'll be returning */
     long i,j;
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13611)
+++ ChangeLog	(revision 13612)
@@ -1,3 +1,10 @@
+Thu Oct  4 15:49:33 2007  Yukihiro Matsumoto  <matz@r...>
+
+	* array.c (rb_ary_permutation): remove C99 dependency.
+	  [ruby-dev:31934]
+
+	* array.c (rb_ary_product): ditto.
+
 Wed Oct  3 23:37:17 2007  Yukihiro Matsumoto  <matz@r...>
 
 	* ext/nkf/nkf.c, bin/ri, bin/irb: fixed typos in doc and comments.
Index: version.h
===================================================================
--- version.h	(revision 13611)
+++ version.h	(revision 13612)
@@ -1,7 +1,7 @@
 #define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2007-10-03"
+#define RUBY_RELEASE_DATE "2007-10-04"
 #define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20071003
+#define RUBY_RELEASE_CODE 20071004
 #define RUBY_PATCHLEVEL 0
 
 #define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
 #define RUBY_VERSION_TEENY 0
 #define RUBY_RELEASE_YEAR 2007
 #define RUBY_RELEASE_MONTH 10
-#define RUBY_RELEASE_DAY 3
+#define RUBY_RELEASE_DAY 4
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];

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

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