Skip to content

Commit 47679bc

Browse files
committed
* 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
1 parent 19c96df commit 47679bc

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Sat Jun 25 15:49:18 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* enum.c (enum_min, enum_max): do not ignore nil as the first element.
4+
15
Sat Jun 25 14:40:17 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
26

37
* ext/sdbm/init.c (fsdbm_select): SDBM#select had returned the array

enum.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ min_i(i, memo)
607607
{
608608
VALUE cmp;
609609

610-
if (NIL_P(*memo)) {
610+
if (*memo == Qundef) {
611611
*memo = i;
612612
}
613613
else {
@@ -626,7 +626,7 @@ min_ii(i, memo)
626626
{
627627
VALUE cmp;
628628

629-
if (NIL_P(*memo)) {
629+
if (*memo == Qundef) {
630630
*memo = i;
631631
}
632632
else {
@@ -657,7 +657,7 @@ static VALUE
657657
enum_min(obj)
658658
VALUE obj;
659659
{
660-
VALUE result = Qnil;
660+
VALUE result = Qundef;
661661

662662
rb_iterate(rb_each, obj, rb_block_given_p() ? min_ii : min_i, (VALUE)&result);
663663
return result;
@@ -684,7 +684,7 @@ max_i(i, memo)
684684
{
685685
VALUE cmp;
686686

687-
if (NIL_P(*memo)) {
687+
if (*memo == Qundef) {
688688
*memo = i;
689689
}
690690
else {
@@ -703,7 +703,7 @@ max_ii(i, memo)
703703
{
704704
VALUE cmp;
705705

706-
if (NIL_P(*memo)) {
706+
if (*memo == Qundef) {
707707
*memo = i;
708708
}
709709
else {
@@ -733,7 +733,7 @@ static VALUE
733733
enum_max(obj)
734734
VALUE obj;
735735
{
736-
VALUE result = Qnil;
736+
VALUE result = Qundef;
737737

738738
rb_iterate(rb_each, obj, rb_block_given_p() ? max_ii : max_i, (VALUE)&result);
739739
return result;

0 commit comments

Comments
 (0)