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

ruby-changes:31829

From: nobu <ko1@a...>
Date: Fri, 29 Nov 2013 16:45:13 +0900 (JST)
Subject: [ruby-changes:31829] nobu:r43908 (trunk): array.c, enum.c, range.c: rb_block_call_func compatible

nobu	2013-11-29 16:45:00 +0900 (Fri, 29 Nov 2013)

  New Revision: 43908

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

  Log:
    array.c, enum.c, range.c: rb_block_call_func compatible
    
    * array.c (take_i), range.c (first_i): make rb_block_call_func
      compatible.
    
    * enum.c (collect_all, DEFINE_ENUMFUNCS): add blockarg.
    
    * enum.c ({min,max,minmax,chunk,slicebefore}_ii): ditto.

  Modified files:
    trunk/array.c
    trunk/enum.c
    trunk/range.c
Index: array.c
===================================================================
--- array.c	(revision 43907)
+++ array.c	(revision 43908)
@@ -3169,8 +3169,9 @@ rb_ary_delete_if(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L3169
 }
 
 static VALUE
-take_i(VALUE val, VALUE *args, int argc, VALUE *argv, VALUE blockarg)
+take_i(VALUE val, VALUE cbarg, int argc, const VALUE *argv, VALUE blockarg)
 {
+    VALUE *args = (VALUE *)cbarg;
     if (args[1]-- == 0) rb_iter_break();
     if (argc > 1) val = rb_ary_new4(argc, argv);
     rb_ary_push(args[0], val);
Index: enum.c
===================================================================
--- enum.c	(revision 43907)
+++ enum.c	(revision 43908)
@@ -400,7 +400,7 @@ collect_i(VALUE i, VALUE ary, int argc, https://github.com/ruby/ruby/blob/trunk/enum.c#L400
 }
 
 static VALUE
-collect_all(VALUE i, VALUE ary, int argc, VALUE *argv)
+collect_all(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg)
 {
     rb_thread_check_ints();
     rb_ary_push(ary, rb_enum_values_pack(argc, argv));
@@ -1003,13 +1003,13 @@ enum_sort_by(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enum.c#L1003
 static VALUE enum_##name##_func(VALUE result, NODE *memo); \
 \
 static VALUE \
-name##_i(VALUE i, VALUE memo, int argc, VALUE *argv) \
+name##_i(VALUE i, VALUE memo, int argc, VALUE *argv, VALUE blockarg) \
 { \
     return enum_##name##_func(rb_enum_values_pack(argc, argv), RNODE(memo)); \
 } \
 \
 static VALUE \
-name##_iter_i(VALUE i, VALUE memo, int argc, VALUE *argv) \
+name##_iter_i(VALUE i, VALUE memo, int argc, VALUE *argv, VALUE blockarg) \
 { \
     return enum_##name##_func(enum_yield(argc, argv), RNODE(memo));	\
 } \
@@ -1182,7 +1182,7 @@ min_i(VALUE i, VALUE args, int argc, VAL https://github.com/ruby/ruby/blob/trunk/enum.c#L1182
 }
 
 static VALUE
-min_ii(VALUE i, VALUE args, int argc, VALUE *argv)
+min_ii(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
 {
     VALUE cmp;
     NODE *memo = RNODE(args);
@@ -1254,7 +1254,7 @@ max_i(VALUE i, VALUE args, int argc, VAL https://github.com/ruby/ruby/blob/trunk/enum.c#L1254
 }
 
 static VALUE
-max_ii(VALUE i, VALUE args, int argc, VALUE *argv)
+max_ii(VALUE i, VALUE args, int argc, VALUE *argv, VALUE blockarg)
 {
     NODE *memo = RNODE(args);
     VALUE cmp;
@@ -1386,7 +1386,7 @@ minmax_ii_update(VALUE i, VALUE j, struc https://github.com/ruby/ruby/blob/trunk/enum.c#L1386
 }
 
 static VALUE
-minmax_ii(VALUE i, VALUE _memo, int argc, VALUE *argv)
+minmax_ii(VALUE i, VALUE _memo, int argc, VALUE *argv, VALUE blockarg)
 {
     struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value;
     int n;
@@ -2365,7 +2365,7 @@ struct chunk_arg { https://github.com/ruby/ruby/blob/trunk/enum.c#L2365
 };
 
 static VALUE
-chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
+chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv, VALUE blockarg)
 {
     struct chunk_arg *argp = MEMO_FOR(struct chunk_arg, _argp);
     VALUE v;
@@ -2560,7 +2560,7 @@ struct slicebefore_arg { https://github.com/ruby/ruby/blob/trunk/enum.c#L2560
 };
 
 static VALUE
-slicebefore_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
+slicebefore_ii(VALUE i, VALUE _argp, int argc, VALUE *argv, VALUE blockarg)
 {
     struct slicebefore_arg *argp = MEMO_FOR(struct slicebefore_arg, _argp);
     VALUE header_p;
Index: range.c
===================================================================
--- range.c	(revision 43907)
+++ range.c	(revision 43908)
@@ -844,8 +844,9 @@ range_end(VALUE range) https://github.com/ruby/ruby/blob/trunk/range.c#L844
 
 
 static VALUE
-first_i(VALUE i, VALUE *ary)
+first_i(VALUE i, VALUE cbarg, int argc, VALUE *argv, VALUE blockarg)
 {
+    VALUE *ary = (VALUE *)cbarg;
     long n = NUM2LONG(ary[0]);
 
     if (n <= 0) {

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

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