diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-25 06:49:40 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-25 06:49:40 +0000 |
| commit | 8d333716be6ce8e4a75fa5980e0ac7da43a34a50 (patch) | |
| tree | b91d9ff1a7185824c29acee56bdfd4f26804cee5 | |
| parent | f2439b59902a6864113d84eaf4714ad8d9557019 (diff) | |
| download | ruby-8d333716be6ce8e4a75fa5980e0ac7da43a34a50.tar.gz ruby-8d333716be6ce8e4a75fa5980e0ac7da43a34a50.tar.xz ruby-8d333716be6ce8e4a75fa5980e0ac7da43a34a50.zip | |
* enum.c (enum_min, enum_max): do not ignore nil as the first element.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@8665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | enum.c | 12 |
2 files changed, 10 insertions, 6 deletions
@@ -1,3 +1,7 @@ +Sat Jun 25 15:49:18 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * enum.c (enum_min, enum_max): do not ignore nil as the first element. + Sat Jun 25 14:40:17 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp> * ext/sdbm/init.c (fsdbm_select): SDBM#select had returned the array @@ -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; |
