mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* enum.c (all_iter_i, any_iter_i): reduced duplicated code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2c7ff4527d
commit
a580ccf6e3
2 changed files with 20 additions and 24 deletions
|
|
@ -1,3 +1,7 @@
|
|||
Sun May 11 23:19:39 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* enum.c (all_iter_i, any_iter_i): reduced duplicated code.
|
||||
|
||||
Sun May 11 17:57:36 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in (MINIRUBY): should not include extension library path.
|
||||
|
|
|
|||
40
enum.c
40
enum.c
|
|
@ -843,18 +843,6 @@ enum_sort_by(obj)
|
|||
return ary;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
all_iter_i(i, memo)
|
||||
VALUE i;
|
||||
VALUE *memo;
|
||||
{
|
||||
if (!RTEST(rb_yield(i))) {
|
||||
*memo = Qfalse;
|
||||
rb_iter_break();
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
all_i(i, memo)
|
||||
VALUE i;
|
||||
|
|
@ -867,6 +855,14 @@ all_i(i, memo)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
all_iter_i(i, memo)
|
||||
VALUE i;
|
||||
VALUE *memo;
|
||||
{
|
||||
return all_i(rb_yield(i), memo);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* enum.all? [{|obj| block } ] => true or false
|
||||
|
|
@ -894,18 +890,6 @@ enum_all(obj)
|
|||
return result;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
any_iter_i(i, memo)
|
||||
VALUE i;
|
||||
VALUE *memo;
|
||||
{
|
||||
if (RTEST(rb_yield(i))) {
|
||||
*memo = Qtrue;
|
||||
rb_iter_break();
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
any_i(i, memo)
|
||||
VALUE i;
|
||||
|
|
@ -918,6 +902,14 @@ any_i(i, memo)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
any_iter_i(i, memo)
|
||||
VALUE i;
|
||||
VALUE *memo;
|
||||
{
|
||||
return any_i(rb_yield(i), memo);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* enum.any? [{|obj| block } ] => true or false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue