* enum.c (take_while_i, drop_while_i) add RTEST to handle nil return
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a95d19bf59
commit
d04b7871a1
@ -1,3 +1,6 @@
|
|||||||
|
Thu Nov 1 14:51:39 UTC 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
||||||
|
* enum.c (take_while_i, drop_while_i) add RTEST to handle nil return
|
||||||
|
|
||||||
Thu Nov 1 02:12:50 2007 NAKAMURA Usaku <usa@ruby-lang.org>
|
Thu Nov 1 02:12:50 2007 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* common.mk (prereq): update the path of prelude.c.
|
* common.mk (prereq): update the path of prelude.c.
|
||||||
|
4
enum.c
4
enum.c
@ -1435,7 +1435,7 @@ enum_take(VALUE obj, VALUE n)
|
|||||||
static VALUE
|
static VALUE
|
||||||
take_while_i(VALUE i, VALUE *ary)
|
take_while_i(VALUE i, VALUE *ary)
|
||||||
{
|
{
|
||||||
if (!rb_yield(i)) rb_iter_break();
|
if (!RTEST(rb_yield(i))) rb_iter_break();
|
||||||
rb_ary_push(*ary, i);
|
rb_ary_push(*ary, i);
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
@ -1501,7 +1501,7 @@ enum_drop(VALUE obj, VALUE n)
|
|||||||
static VALUE
|
static VALUE
|
||||||
drop_while_i(VALUE i, VALUE *args)
|
drop_while_i(VALUE i, VALUE *args)
|
||||||
{
|
{
|
||||||
if (!args[1] && !rb_yield(i)) {
|
if (!args[1] && !RTEST(rb_yield(i))) {
|
||||||
args[1] = Qtrue;
|
args[1] = Qtrue;
|
||||||
}
|
}
|
||||||
if (args[1]) {
|
if (args[1]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user