File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change
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
+
1
5
Sat Jun 25 14:40:17 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
2
6
3
7
* ext/sdbm/init.c (fsdbm_select): SDBM#select had returned the array
Original file line number Diff line number Diff line change @@ -607,7 +607,7 @@ min_i(i, memo)
607
607
{
608
608
VALUE cmp ;
609
609
610
- if (NIL_P ( * memo ) ) {
610
+ if (* memo == Qundef ) {
611
611
* memo = i ;
612
612
}
613
613
else {
@@ -626,7 +626,7 @@ min_ii(i, memo)
626
626
{
627
627
VALUE cmp ;
628
628
629
- if (NIL_P ( * memo ) ) {
629
+ if (* memo == Qundef ) {
630
630
* memo = i ;
631
631
}
632
632
else {
@@ -657,7 +657,7 @@ static VALUE
657
657
enum_min (obj )
658
658
VALUE obj ;
659
659
{
660
- VALUE result = Qnil ;
660
+ VALUE result = Qundef ;
661
661
662
662
rb_iterate (rb_each , obj , rb_block_given_p () ? min_ii : min_i , (VALUE )& result );
663
663
return result ;
@@ -684,7 +684,7 @@ max_i(i, memo)
684
684
{
685
685
VALUE cmp ;
686
686
687
- if (NIL_P ( * memo ) ) {
687
+ if (* memo == Qundef ) {
688
688
* memo = i ;
689
689
}
690
690
else {
@@ -703,7 +703,7 @@ max_ii(i, memo)
703
703
{
704
704
VALUE cmp ;
705
705
706
- if (NIL_P ( * memo ) ) {
706
+ if (* memo == Qundef ) {
707
707
* memo = i ;
708
708
}
709
709
else {
@@ -733,7 +733,7 @@ static VALUE
733
733
enum_max (obj )
734
734
VALUE obj ;
735
735
{
736
- VALUE result = Qnil ;
736
+ VALUE result = Qundef ;
737
737
738
738
rb_iterate (rb_each , obj , rb_block_given_p () ? max_ii : max_i , (VALUE )& result );
739
739
return result ;
You can’t perform that action at this time.
0 commit comments