зеркало из https://github.com/github/ruby.git
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9f45081627
Коммит
32145ebfd6
3
array.c
3
array.c
|
@ -3169,8 +3169,9 @@ rb_ary_delete_if(VALUE ary)
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
16
enum.c
16
enum.c
|
@ -400,7 +400,7 @@ collect_i(VALUE i, VALUE ary, int argc, VALUE *argv, VALUE blockarg)
|
|||
}
|
||||
|
||||
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)
|
|||
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, VALUE *argv, VALUE blockarg)
|
|||
}
|
||||
|
||||
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, VALUE *argv, VALUE blockarg)
|
|||
}
|
||||
|
||||
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, struct minmax_t *memo)
|
|||
}
|
||||
|
||||
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 {
|
|||
};
|
||||
|
||||
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 {
|
|||
};
|
||||
|
||||
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;
|
||||
|
|
3
range.c
3
range.c
|
@ -844,8 +844,9 @@ range_end(VALUE range)
|
|||
|
||||
|
||||
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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче