summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-25 06:49:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-25 06:49:40 +0000
commit47679bcf0aea586af1aa3a8bee0c6356c2993f5a (patch)
treeb91d9ff1a7185824c29acee56bdfd4f26804cee5 /enum.c
parent19c96dfff9bad038a57a377971d5289ae4cd1607 (diff)
* enum.c (enum_min, enum_max): do not ignore nil as the first element.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/enum.c b/enum.c
index ca52b6f566..102257fa76 100644
--- a/enum.c
+++ b/enum.c
@@ -607,7 +607,7 @@ min_i(i, memo)
{
VALUE cmp;
- if (NIL_P(*memo)) {
+ if (*memo == Qundef) {
*memo = i;
}
else {
@@ -626,7 +626,7 @@ min_ii(i, memo)
{
VALUE cmp;
- if (NIL_P(*memo)) {
+ if (*memo == Qundef) {
*memo = i;
}
else {
@@ -657,7 +657,7 @@ static VALUE
enum_min(obj)
VALUE obj;
{
- VALUE result = Qnil;
+ VALUE result = Qundef;
rb_iterate(rb_each, obj, rb_block_given_p() ? min_ii : min_i, (VALUE)&result);
return result;
@@ -684,7 +684,7 @@ max_i(i, memo)
{
VALUE cmp;
- if (NIL_P(*memo)) {
+ if (*memo == Qundef) {
*memo = i;
}
else {
@@ -703,7 +703,7 @@ max_ii(i, memo)
{
VALUE cmp;
- if (NIL_P(*memo)) {
+ if (*memo == Qundef) {
*memo = i;
}
else {
@@ -733,7 +733,7 @@ static VALUE
enum_max(obj)
VALUE obj;
{
- VALUE result = Qnil;
+ VALUE result = Qundef;
rb_iterate(rb_each, obj, rb_block_given_p() ? max_ii : max_i, (VALUE)&result);
return result;