diff options
author | davidflanagan <davidflanagan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-01 05:53:52 +0000 |
---|---|---|
committer | davidflanagan <davidflanagan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-01 05:53:52 +0000 |
commit | d04b7871a12fa2ddbe518f53da9632d0bb37b906 (patch) | |
tree | c3109a1d0a2e13716b5a362ad7e235946834ddda /enum.c | |
parent | a95d19bf5988b60d3649f18d267e25a666955476 (diff) | |
download | ruby-d04b7871a12fa2ddbe518f53da9632d0bb37b906.tar.gz |
* 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
Diffstat (limited to 'enum.c')
-rw-r--r-- | enum.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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]) { |