1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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:
davidflanagan 2007-11-01 05:53:52 +00:00
parent a95d19bf59
commit d04b7871a1
2 changed files with 5 additions and 2 deletions

View file

@ -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>
* common.mk (prereq): update the path of prelude.c.

4
enum.c
View file

@ -1435,7 +1435,7 @@ enum_take(VALUE obj, VALUE n)
static VALUE
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);
return Qnil;
}
@ -1501,7 +1501,7 @@ enum_drop(VALUE obj, VALUE n)
static VALUE
drop_while_i(VALUE i, VALUE *args)
{
if (!args[1] && !rb_yield(i)) {
if (!args[1] && !RTEST(rb_yield(i))) {
args[1] = Qtrue;
}
if (args[1]) {